# Matlab plot

0
sankme a 13 Rep.

I am trying to plot 16 fir filters output in one figure. I am using fvtool command in Matlab to plot. I get 16 different plots. Any suggestions?

Thanks

0
sankme a 13 Rep.

Thank you Mathuranathan. I will try this and see.

0
Mathuranathan 312 Rep.

The solution is to invoke fvtool with arguments set to the desired 16 filter coefficients.

fvtool(B0,A0,B1,A1,B2,A2, B3,A3, … , B15,A15)

where, B_n and A_n are numerator and denominator polynomial coefficients of filter n.

Example with 3 different filters – Butterworth, Chebyshev Type I and Type II filters:

%4th-order butterworth band-pass filter which passes frequencies
%between 0.15 and 0.3.
[b0,a0]=butter(2,[.15,.3]); %filter 0 coefficients

% 2nd-order Chebyshev Type I band-pass filter which passes frequencies
% between 0.2 and 0.5 with 3 dB of ripple in the passband.
[b1,a1]=cheby1(2,3,[.2,.5]);  %filter 1 coefficients

%6th-order Chebyshev Type II band-pass filter which passes frequencies
%between 0.2 and 0.5 and with stopband attenuation 80 dB down from the passband.
[b2,a2]=cheby2(6,80,[.2,.5]); % Bandpass digital filter design

After the design, invoke the fvtool with arguments set for analyzing multiple filters as follows

handle=fvtool(b0,a0,b1,a1,b2,a2);
legend(handle,’Butterworth’,’Chebyshev Type I’,’Chebyshev Type II’);

Resulting plot:

### Attachments

fvtool_plot_in_same_figure.png