Plot transfer function of band pass filter

11 Ansichten (letzte 30 Tage)
MIRK
MIRK am 24 Feb. 2015
Beantwortet: Rick Rosson am 24 Feb. 2015
I want to compare between BPF with diffrent order using butterworth the figured produced doesn't look like the transfer function of band pass what is the problem in my code??
fs = 100*7000;
ts = 1/fs ;
t = -2 : ts : 2- ts ;
NO = length(t);
f=(-NO/2 : NO/2 -1)/(NO * ts);
imp = zeros(1,NO);
imp(1+2*fs)=NO;
cutoff_PPF=[6000,10000] ;
[a11,b11]=butter(1,2*cutoff_PPF*ts); % PBF of Order 2
[a22,b22]=butter(2,2*cutoff_PPF*ts); % PBF of Order 3
[a33,b33]=butter(3,2*cutoff_PPF*ts); % PBF of Order 6
zP_O1 = filter(a11,b11,imp);
zP_O4 = filter(a22,b22,imp);
zP_O6 = filter(a33,b33,imp);
ZP_O2 = abs(fftshift(fft(zL_O1)/NO));
ZP_O4 = abs(fftshift(fft(zL_O4)/NO));
ZP_O6 = abs(fftshift(fft(zL_O6)/NO));
figure(2);
subplot(221);
plot(f,ZP_O2);
xlabel('Frequency');
ylabel('Magnitude');
legend('ZP_O2');
title('The Transfer Function of PPF _order 2)');
%xlim([-100000,100000])
subplot(222);
plot(f,ZP_O4);
xlabel('Frequency');
ylabel('Magnitude');
legend('ZP_O4');
title('The Transfer Function of PPF _order 4)');
%xlim([-,])
subplot(223);
plot(f,ZP_O6);
xlabel('Frequency');
ylabel('Magnitude');
legend('ZP_O6');
title('The Transfer Function of PPF _order 6)');
%xlim([-,])

Antworten (1)

Rick Rosson
Rick Rosson am 24 Feb. 2015
doc fvtool
doc freqz

Community Treasure Hunt

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

Start Hunting!

Translated by