Plot transfer function of band pass filter

조회 수: 2 (최근 30일)
MIRK
MIRK 2015년 2월 24일
답변: Rick Rosson 2015년 2월 24일
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([-,])

답변 (1개)

Rick Rosson
Rick Rosson 2015년 2월 24일
doc fvtool
doc freqz

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by