Design low pass filter with a given transfer function

조회 수: 2 (최근 30일)
Giovanni Lo Bocchiaro
Giovanni Lo Bocchiaro 2019년 5월 24일
I must design a low-pass filter with a given transfer function in z-domain:
H(z) = (1-z^(-6))^2 / (1-z^(-1))^2
Considering the x signal (1x2000) I want to filter, i wrote
N = 2000;
h1 = zeros(1,N);
%
% a. Low-Pass Filter
for i = 1:N
if (i == 1)
h1(1) = 1;
a1(1) = 1;
b1(1) = 1;
else
if (i == 2)
h1(2) = 1/(1-2*x(1));
b1(2) = 1;
a1(2) = 1-2*x(1);
else
if ((i == 3) || (i == 4) || (i == 5) || (i == 6))
h1(i) = 1/(1+x(i-2)-2*(x(i-1)));
b1(i) = 1;
a1(i) = (1+x(i-2)-2*(x(i-1)));
else
if ((i == 7) || (i == 8) || (i == 9) || (i == 10) || (i == 11) || (i == 12))
h1(i) = ((1-2*x(i-6)))/(1+(x(i-2))-2*(x(i-1)));
b1(i) = (1-2*x(i-6));
a1(i) = (1+(x(i-2))-2*(x(i-1)));
else
h1(i) = ((1+(x(i-12))-2*(x(i-6))))/(1+(x(i-2))-2*x(i-1));
b1(i) = ((1+(x(i-12))-2*(x(i-6))));
a1(i) = (1+(x(i-2))-2*x(i-1));
end
end
end
end
end
figure,
freqz(b1,a1,512,fc);
y = filter(b1,a1,x);
Is it correct? I don't think so because the plot it is a mess and definitively not a low-pass! What is it wrong?

답변 (0개)

카테고리

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