Dear group, I have implemented an algorithm that calculates the coefficients of an FIR filter using the frequency sampling method. The result I obtain using my algorithm and that obtained using the fir2 function in MATLAB differ in the following way. My ideal frequency response consists of peak in the gain that is aproximated with a high degreee of accuracy by the frequency response of the filter designed with the FIR2 function. In my algorithm the shape of the fequency response seems fine but the magnitude of the frequency response is underestimated by around 40%. Does anybody have any suggestions as to what the problem may be? Luca
frequency sampling method implementation
Started by ●July 5, 2004
Reply by ●July 6, 20042004-07-06
"Luca Notini" <L.notini@lboro.ac.uk> wrote in message news:<ccbvdp$4bk$1@sun-cc204.lut.ac.uk>...> Dear group, > > I have implemented an algorithm that calculates the coefficients of an FIR > filter using the frequency sampling method. > The result I obtain using my algorithm and that obtained using the fir2 > function in MATLAB differ in the following way. > > My ideal frequency response consists of peak in the gain that is aproximated > with a high degreee of accuracy by the frequency response of the filter > designed with the FIR2 function. In my algorithm the shape of the fequency > response seems fine but the magnitude of the frequency response is > underestimated by around 40%. > > Does anybody have any suggestions as to what the problem may be?If I were to guess, I'd suggest this was due to some kind of energy or gain preservation. If one specified a filter using FIR2 as>> B=fir2(32,[0,1],[1,1]);one might want that the energy of the output equals the energy of the input. As it happens, the resulting B has this property (but it also has a trivial impulse response...), but when I test with the half-band target function>> B=fir2(32,[0,0.49,0.51,1],[1,1,0,0]);I find that the norm of the filter is>> B*B'ans = 0.4746 which means that approximately half the energy of the input signal is preserved at the output. FWIW, Rune