Need to know the plot comands for Low, High, Band Pass, and Notch filter
Show older comments
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)
Wayne King
on 21 Jun 2012
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)
Kelvin
on 21 Jun 2012
0 votes
Wayne King
on 21 Jun 2012
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);
Kelvin
on 21 Jun 2012
0 votes
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!