See also: Fourier transform, IIR filter design

Containers for linear filters

This is a container library for linear filters. It consists of three different container structures:

 TransferFunction Transfer function polynomial. ZeroPoleGain The Zero-Pole-Gain representation of the system. SignalChain An arbitrary list of the former two.

They all have the same interface, but there are differences in the performance of certain methods.

Every data member of these structures is public.

import signals.containers-1;
Creating linear filter structures
import signals.containers-1;
my_tf = new ( [ new TransferFunction( [1,2,3,4,5,6], // numerator of the polynomial [7,8,9] // denominator of the polynomial ,150 Hz // sampling frequency, optional ), new ZeroPoleGain( [1,1,0.5,-0.3], // zeros [0,-0.5+0.3j,-0.5-0.3j, 0.95j, -0.95j], // poles 1 // gain ,150 Hz // sampling frequency, optional ) ]) Create Structure
Visualization
my_tf.plotAmplitude(20/* number of points */) // The Y axis is in logarithmic (dB) scale. Amplitude Plot my_tf.plotPhase(20/* number of points */) Phase Plot my_tf.plotZerosPoles() Pole-Zero Plot my_tf.plotImpulseResponse(20/* number of points */) Impulse Response my_tf.plot() // plot in the native form Plot

plot() has different behaviors in different representations. In the cases of TransferFunction or SignalChain, it plots the amplitude response. In the case of ZeroPoleGain, it plots the pole-zero diagram.

Using the structures

Filtering a test signal
input = [! zeros(100,1), ones(100,1), zeros(100,1), ones(100,1) !]; // test signal filtered = my_tf.filter(input); chart().curve(input).curve(filtered) Filter