%x (n) =sin( pi*n/ 5),-10<= 10 (正弦离散函数)
n1=-10:1:10;
x1=sin(pi*n1/5);
subplot(2,2,1);
stem(n1,x1,'.')做离散图
title('sin(pi*n1/5)');
%做卷积conv函数
x2=[2,1,-2];
h2=[1,2,-1];
y=conv(x2,h2);
subplot(2,2,2);
stem(x2,h2,'.')
title('y(n)=x(n)*h(n)');
%y(n)=0.7y(n-1)-0.1y(n-2)+2x(n)-x(n-2),求其单位脉
%冲响应和单位阶跃响应并作图(前 20 个序列值)。
B=[2 0 -1];x(n),x(n-1)......系数
A=[1,-0.7,0.1];y(n),y(n-1).....系数
xn=[1,zeros(1,19)];长度为20的单位脉冲
hn1=filter(B,A,xn);
n=0:length(hn1)-1;
subplot(2,2,3);
stem(n,hn1,'.')
title('系统单位脉冲响应');
xn2=ones(1,20);
sn1=filter(B,A,xn2);
n=0:length(sn1)-1;
subplot(2,2,4);
stem(n,sn1,'.')
title('系统单位阶跃响应');
数字信号处理matlab卷积函数conv,filter函数详细介绍三秒钟就看懂。
最新推荐文章于 2024-04-22 12:22:29 发布