freqz calculates the complex response
of a digital filter from the a and b
coefficients of the DE . We must think of H(z) in the form :
Here eg
is the greatest (negative) power of z in X(z). b(1) is the first element
of a MATLAB row vector b (it is what we would normally write
in these lectures).
So in our above example :
MATLAB instructions to use freqz :
b=[1,0,-1] a=[1,0,0,0,0.25] [H,w]=freqz(b,a,512) % do 512 frequencies in the range 0 to pi M=abs(H) P=angle(H) plot(w,M,'o') % plot amplitude response plot(w,P,'o') % plot phase response
Logarithmic (Bode) plots
Bode plots plot :
Note the application of MATLAB semilogx for such plots.