Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



"Simple" filter design wrong answer
Posted:
Sep 15, 1996 1:25 AM


Here is a little problem that should work but does not. I'm using the Signal Processing Toolbox 3 on Matlab 4.2c. I tell it to design a second order FIR notch filter and display the frequency domain transfer function:
b=fir1(2,[.49 .51],'stop'); freqz(b,1,512);
The correct answer is b = [.5 0 .5], (this really is a notch at 1/2)but the output of fir1 is completely wrong. If I use n=4 or more it always works fine. If I try making the points farther apart, such as .25 and .75, it still fails. If I try fir2 with many different appropriate choices of line segments, it still always fails for n=2 and always works for n=4 or more. If I run a firls design it also always fails for n=2 and always works for n=4 or more.
If I ask for the notch to be some other frequency, I get the same problem. There are no warnings or errors.
This is very strange. I feel I must be doing something terribly obvious wrong.
Does anyone have any suggestions? I am a somewhat experienced user. I never had this kind of results before, but I guess I never told it to do just this problem before. I've never been this old before, either.
Thanks for your help. Dan Babitch



