Designs a FIR filter from a given magnitude response using the frequency sampling method.
FREQSAMP(f, m, full)
f |
- |
An XY series specifying the desired frequencies (in Hertz) and magnitudes of the filter or an explicit series specifying the frequencies only. |
m |
- |
Optional. A series, the explicit desired magnitudes. |
full |
- |
Optional. An integer specifying if f and m represent the entire magnitude response. 1: full response, 0: response from 0 Hz to the Nyquist frequency. Defaults to 0. |
A series, the impulse response of the filter.
W1: {0, 1, 10, 20, 30}
W2: {1, 1, 2, 0, 0}
W3: xy(W1, W2)
W4: freqsamp(W3)
W5: mag(fft(W4, bestpow2(length(W4))))
W4 contains a 61 point linear phase FIR filter. The filter has unity gain from at 0 and 1 Hz and a gain of 2 at 10 Hz. W5 shows the magnitude response of the filter.
freqsamp(W1, W2)
Same as above, except the frequencies and magnitudes are specified explicitly.
W1: {1, 1, 2, 1, 0, 0}
W2: freqsamp(W1);
W3: mag(fft(W2));overp(W1, lred)
An arbitrary magnitude response is created in W1 and the magnitude response of the resulting frequency sampling filter is compared in W3.
W1: hamming(gsinc(100, .1, 2*pi, -5*2*pi));setxoffset(-5.0)
W2: mag(fft(W1))
W3: freqsamp(W2, 1)
W4: W1-W3
W1 creates a simple 1 Hz low pass filter with a gain of 5.0. The impulse response using the frequency sampling method is compared to the original impulse response in W4. The entire magnitude response is used to design the filter.
The FIR filter is designed by performing the IFFT of the given magnitude response after adding a linear phase component. The resulting FIR filter has linear phase.
FREQSAMP sorts the input frequencies in ascending order. If a frequency of 0 Hz is not specified, a 0 Hz term equal to the magnitude of the frequency nearest 0 is added to the list.
See ZPFCOEF to convert an analog filter specification to a digital filter.