Using matLab FIR1 filter design - problem

Status
Not open for further replies.

maryszoo

Newbie level 2
Joined
May 8, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
matlab fir1

Hi -

I am using FIR1, and then plotting the filter response. The definition of FIR1 says the response should be -6db at Wn. However, I have plotted this many differnet ways, and the -6dB point is not at Wn. Here is the code, to show the problem. I would appreciate any help.
%
% Plot the FIR filter using FREQZ
%
FIR_NUM = fir1(8,0.1); % Numerator
% This is a filter. It should have 9 coefficients,
% and the Wn value = 0.1*(100kHz/2) = 5kHz
% By definition, the response should be -6dB at 5kHz or Wn = 0.1
% normalized.
FIR_DEN = [1 0 0 0 0 0 0 0 0]; % Denominator
%
freqz(FIR_NUM,FIR_DEN)
% PROBLEM: The -6dB point is around 0.22, not 0.1

Thank you - Mary
 

fir1 matlab

You have to understand the limitations of the fir1 design method and the general FIR restrictions when using too few coefficients. You can try, that the result of fir1 is rather accurate for a higher number of coefficients.

Your example demonstrates two points:
- You can't achieve a steep FIR filter with only 9 coefficients
- An approximation method doesn't achieve an exact result, when other conditions are against it

You can simplify the freqz expression, particularly useful with higher filter orders
Code:
freqz(FIR_NUM,1)
 

fir1 filter

Thank you - that makes sense, I was just worried that I was doing something wrong.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…