u can use following function,which i write
in this function fo is notch freq and fs is sampling freq
fo < fs/2

function [b,a] = notch(fo,fs)

deg=fo/fs*360;
c=[cosd(deg)+j*sind(deg) ,cosd(deg)-j*sind(deg)];
b=poly(c);
a=zeros(1,length(b));
a(1) = 1;
g=sum(b);
b=b/g;
a=a/g;
end

discreteworld <discreteworld@disc...> wrote:
To: matlab@matl...
From: "discreteworld" <discreteworld@disc...>
Date: Sat, 31 Dec 2005 18:24:06 -0000
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?