Need to know the plot comands for Low, High, Band Pass, and Notch filter

Hello, I'm new to MatLab and trying to find the commands to plot the frequency response for Low, High, Band Pass, and Notch filter but could not find them. I've the zero=+-20 and pole=+-j20. Please help!
Thanks for your help in advance!

Answers (4)

You can use freqz(). Do you only have your filter in terms of zeros and poles? or do you have the coefficients? If you just have the zeros and poles, use zp2tf to get the coefficients, then use freqz()
z =[-20+1j*0 ; 20+1j*0]; p = [-1j*20 ;1j*20];
[num,den] = zp2tf(z,p,1);
freqz(num,den);
You can also use fvtool()
fvtool(num,den)
Thanks, Wayne. Yes, I only have my filters in terms of zeros and poles. Are those commands above used plotting for all the filters? Pls advise! Thanks.
Yes, you can use freqz and fvtool, but you have to get your filter specified in a way that freqz() or fvtool() can handle. So you have to convert from zeros and poles to either coefficients, or maybe a state-space representation and then create a state-space dfilt object that freqz() or fvtool() can handle.
As a state-space example: (I'm using your zeros and poles from the earlier post)
[A,B,C,D] = zp2ss(z,p,1);
% now create a state-space dfilt object
Hd=dfilt.statespace(A,B,C,D);
% now I can use freqz() or fvtool()
fvtool(Hd);
I have the transfer function H(z)=(z2+49)/(z-0.7)(z+0.7). After calculation, I got num=[1 0 49] and den=[1 0 0.049]. So, I plotted in freqz(num,den) then it came out the phase and madnitude but I'm quite sure they're corrected. Could you please help to check what calculation I've missed? Thanks.

Asked:

on 21 Jun 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!