Forums

Freqz function- plssssss help

Started by discreteworld December 31, 2005


I am using notch filter, below are the commands for calculating
filter coeff:

f0 = 0.4 % freq to be notched

b = [1 -2*cos(2*pi*f0)
1];
% compute the filter numerator coeff "b"

r =0.995;
a = [1 -2*r*cos(2*pi*f0)
r^2];
% compute the filter denominator coeff "a"

[h,f1] =freqz(b,a,256);
figure
plot(f1/(2*pi), abs(h), 'r');

If "f0" i.e the freq to be notched is less than 0.5 then the plot
shows the notch at f0, but if its greater than 0.5 then the plot
shows some different frequency. Any one has any clue regarding this?


You're using two different conventions for relative frequency. The first (commonly used) convention is that the sampling frequency Fs  = 1. Your coefficients are based on this convention, so any notch frequency above 0.5 will exceed the Nyquist frequency Fs/2 and hence be aliased to another frequency.
The second convention (used by most MATLAB signal processing functions such as freqz) is where frequencies are relative to the Nyquist frequency , so Fs = 2.
So the f1 values in your plot range from 0 to 1, representing 0 to Fs/2, not 0 to Fs. Since the frequencies above Fs/2 are just a mirror reflection, they aren't returned by freqz at all.
 
Mark


From: m...@yahoogroups.com [mailto:m...@yahoogroups.com] On Behalf Of discreteworld
Sent: Saturday, December 31, 2005 1:24 PM
To: m...@yahoogroups.com
Subject: [matlab] Freqz function- plssssss help



I am using notch filter, below are the commands for calculating
filter coeff:

f0 = 0.4 % freq to be notched

b = [1 -2*cos(2*pi*f0)
1];                                                                 
% compute the filter numerator coeff "b"  

r =0.995;    
a = [1 -2*r*cos(2*pi*f0)
r^2];                                                              
% compute the filter denominator coeff "a"

[h,f1] =freqz(b,a,256);
figure
plot(f1/(2*pi), abs(h), 'r');

If "f0" i.e the freq to be notched is less than 0.5 then the plot
shows the notch at f0, but if its greater than 0.5 then the plot
shows some different frequency. Any one has any clue regarding this?

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to D...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.