发布网友 发布时间:2022-04-24 10:02
共1个回答
热心网友 时间:2023-10-09 17:00
1;
As=15;
%buttord butter 默认的是采用双线性变换法
[N,wc]=buttord(wp,ws,Rp,As);
[B,A]=butter(N,wc);
wk=0:0.02:pi/2;
subplot(311)
plot(wk,20*log10(abs(freqz(B,A,wk))))
ylabel('dB');
xlabel('w(0-pi/2)');
xn=[-4,-2,0,-4,-6,-4,-2,-4,-6,-6,-4,-4,-6,-6,-2,6,12,8,0,-16,...
-38,-60,-84,-90,-66,-32,-4,-2,-4,8,12,12,10,6,6,6,4,0,0,0,...
0,0,-2,-4,0,0,0,-2,-2,0,0,-2,-2,-2,-2,0] ;
subplot(312)
plot(linspace(0,pi,1024),abs(fft(xn,1024)));
title('原信号频谱');
xlabel('w(0-pi)');
subplot(313)
yn=filter(B,A,xn);
plot(linspace(0,pi,1024),abs(fft(yn,1024)))
title('通过低通滤波器后的频谱');
xlabel('w(0-pi)');
输入序列 为:
=[-4,-2,0,-4,-6,-4,-2,-4,-6,-6,-4,-4,-6,-6,-2,6,12,8,0,-16
-38,-60,-84,-90,-66,-32,-4,-2,-4,8,12,12,10,6,6,6,4,0,0,0
0,0,-2,-4,0,0,0,-2,-2,0,0,-2,-2,-2,-2,0]
代码:
%x(n)的心电脉冲函数
x=[-4,-2,0,-4,-6,-4,-2,-4,-6,-6,-4,-4,-6,-6,-2,6,12,8,0,-16,-38,-60,-84,-90,-66,-32,-4,-2,-4,8,12,12,10,6,6,6,4,0,0,0,0,0,-2,-4,0,0,0,-2,-2,0,0,-2,-2,-2,-2,0];
subplot(2,2,1);
n=0:55;
stem(n,x,'.');
xlabel('n');
ylabel('x(n)');
title('x(n)的心电脉冲函数');
%通过滤波器H1(z)后的y1(n)函数
A=0.09036;
b1=[A,2*A,A];
a1=[1,-1.2686,0.7051];
h1=filter(b1,a1,x);
[H1,w]=freqz(b1,a1,100);
%通过滤波器H1(z)、H2(z)后的y2(n)函数
b2=[A,2*A,A];
a2=[1,-1.0106,0.3583];
h2=filter(b2,a2,h1);
[H2,w]=freqz(b2,a2,100);
%通过滤波器H1(z)、H2(z)、H3(z)后的y3(n)函数
b3=[A,2*A,A];
a3=[1,-0.9044,0.2155];
h3=filter(b3,a3,h2);
[H3,w]=freqz(b3,a3,100);
subplot(2,2,2);
stem(n,h3,'.');
xlabel('n');
ylabel('y(n)');
title('通过滤波器H1(z)、H2(z)、H3(z)后的y3(n)函数');
输出结果:追问大哥 能不能给点干货 就只是代码的那种