Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

freqz() and plot()

814 views
Skip to first unread message

Sneha

unread,
Nov 18, 2010, 1:43:03 PM11/18/10
to
Hello,
I am struggling for a simple plot function.
I want to plot two plots....
One is freqz to display frequency responce of a filter and one is normal plot command to show variance in output due to fixed point constraints.

Now when I run the code, only one of the two plots stays, other one disappers quickly.
I tried using subplot with freqz but it doesnot work.
Can you please help me out with this?
How to make both the plots stay?
Thanks

Wayne King

unread,
Nov 18, 2010, 2:36:03 PM11/18/10
to
"Sneha " <sd...@audience.com> wrote in message <ic3s3n$jvq$1...@fred.mathworks.com>...

Hi,
You can do something like this (just an example with some simple FIR filters)

b1 = 0.1*ones(10,1);
b2 = 0.05*ones(20,1);
[h1,w1] = freqz(b1,1,512);
[h2,w2] = freqz(b2,1,512);
plot(w1,20*log10(abs(h1)),'b');
hold on;
plot(w1,20*log10(abs(h2)),'r');
ylabel('dB'); xlabel('Radians/sample');


You can also use fvtool() to plot both your original filter and your quantized filter response:

fvtool(b1,1,b2,1);

Hope that helps,
Wayne

Sneha

unread,
Nov 18, 2010, 2:56:03 PM11/18/10
to
"Wayne King" <wmki...@gmail.com> wrote in message <ic3v73$g3q$1...@fred.mathworks.com>...

Thank you Wayne.
I really appreciate.

0 new messages