心电图信号采样序列题目一:设计任务:对以下心电图下列x(n){x(n)}={-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}设计巴特沃斯IIR数字低通滤波器对其进行信号处理,进行处理前后序列比较,程序如下: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];k=1;figure(1)subplot(2,2,1)n=0:55;stem(n,x,'.');axis([056-10050]);holdon;n=0:60;m=zeros(61);plot(n,m);xlabel('n');ylabel('x(n)');title('心电图采样信号序列x(n)');B=[0.090362*0.090360.09036];A=[1.2686-0.7051];A1=[1.0106-0.3583];A2=[0.9044-0.2155];while(k=3)y=filter(B,A,x);x=y;ifk==2A=A1;endifk==3A=A2;endk=k+1;endsubplot(2,2,3)n=0:55;stem(n,y,'.');axis([056-155]);holdon;n=0:60;m=zeros(61);plot(n,m);xlabel('n');ylabel('y(m)');title('三级滤波以后的的心电图信号');%求数字滤波器的幅频特性A=[0.09036,0.1872,0.09036];B1=[1,-1.2686,0.7051];B2=[1,-1.0106,0.3583];B3=[1,-0.9044,0.2155];[H1,w]=freqz(A,B1,100);[H2,w]=freqz(A,B2,100);[H3,w]=freqz(A,B3,100);H4=H1.*(H2);H=H4.*(H3);mag=abs(H);db=20*log10((mag+eps)/max(mag));subplot(2,2,2)plot(w/pi,db);axis([0,0.5,-50,10]);gridontitle('滤波器的幅频响应曲线');