Skip to content

Matlab plot

44 viewsSignal processing

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?




Thank you Mathuranathan. I will try this and see.


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

legend(handle,’Butterworth’,’Chebyshev Type I’,’Chebyshev Type II’);

Resulting plot: