I'm trying to fit an FIR filter to the measured frequency response (magnitude and phase) of a device. The frequency response is essentially a low-pass filter. I'd like to vary the number of taps to see how many are necessary to appropriately match the response, but also give differing number of precursor and postcursor taps in the design.
I've investigated Matlab's fdesign.arbmag and fdesign.arbmagnphase functions, but these seem to only give designs with the same number of pre- and post-cursor taps.
Here's some sample code with simplified frequency (F) and amplitude (A) values for reference.
F = 0:0.1:1;
A = [1 0.85 0.9 0.7 0.5 0.3 0.35 0.1 0.2 0.1 0];
filterOrder = 7;
d = fdesign.arbmag('N,F,A',filterOrder,F,A);
Hd = design(d);
fvtool(Hd)
tapWeights = [Hd.numerator];
disp(tapWeights)
The above code runs happily, and produces a low-pass filter that matches the frequency response reasonably well, with tap weights as follows:
[0.0030 0.0361 0.2161 0.4500 0.2161 0.0361 0.0030].
However, the central tap (the cursor, 0.45
) is surrounded by three precursor and three postcursor taps. Is there a way to design, say, with one precursor and six postcursors.