实验六----离散线性时不变系统分析实验报告
实验六 离散线性时不变系统分析
1. 设系统冲激响应为h [n ]=⎨⎧n ,0≤n ≤5⎧1,0≤n ≤5,输入信号为x [n ]=⎨, ⎩0, others ⎩0, others
(1) 求输出y 1[n ]=x [n ]*h [n ];
主程序如下:
n=[-5:20];
u1=stepseq(0,-5,20);u2=stepseq(6,-5,20);
x=u1-u2;
h=n.*x;
subplot(3,1,1);stem(n,x);axis([-5 20 0 2]);
title('Input Sequence');
ylabel('x[n]');
subplot(3,1,2);stem(n,h);axis([-5 20 0 6]);
title('Inpulse Response');
ylabel('h[n]');
[y1,ny]=conv_m(x,n,h,n);
subplot(3,1,3);stem(ny,y1);
title('Output Sequence');xlabel('n' );
ylabel('y_1[n]');
Stepseq.m 的源程序如下:
function [x,n]=stepseq(n0,n1,n2);
if nargin ~=3
disp('Usage:Y=stepseq(n0,n1,n2)');
elseif ((n0n2)|(n1>n2));
end
n=[n1:n2];
x=[(n-n0)>=0];
conv_m.m的源程序如下:
function [y,cy]=conv_m(x,nx,h,nh)
if nargin~=4
disp('Usage:Y=conv_m(x,nx,h,nh)');
return ;
end ;
nyb=nx(1)+nh(1);
nye=nx(length(x))+nh(length(x));
ny=[nyb:nye];
y=conv(x,h);
(2)求输出y 2[n ]=x [n ]*h [n +5]
n=-10:20;
u1=stepseq(0,-10,20);u2=stepseq(6,-10,20);
x=u1-u2;
u3=stepseq(-5,-10,20);u4=stepseq(1,-10,20);
x1=u3-u4;
h=(n+5).*x1;
subplot(3,1,1);stem(n,x);
axis([-10 20 0 2]);title('Input sequence');
ylabel('x[n]');
subplot(3,1,2);stem(n,h);
axis([-10 20 0 6]);
title('Inpulse Response');
ylabel('h[n+5]');
[y2,ny]=conv_m(x,n,h,n);
subplot(3,1,3);stem(ny,y2);
title('Output Sequence');xlabel('n' );
ylabel('y_2[n]');
2. 设h [n ]=(0.9)n u [n ],输入x [n ]=u [n ]-u [n -10],求系统输出y [n ]=x [n ]*h [n ]。 n=-5:50;
u1=stepseq(0,-5,50);u2=stepseq(10,-5,50);
x=u1-u2;
h=((0.9).^n).*u1;
subplot(3,1,1);stem(n,x);
axis([-5 20 0 2]);
title('Input Sequence');
ylabel('x[n]');
subplot(3,1,2);
stem(n,h);
axis([-5 20 0 6]);
title('Inpulse Response');
ylabel('h[n]');
[y,ny]=conv_m(x,n,h,n);
subplot(3,1,3);
stem(ny,y);
title('Output Sequence');
xlabel('n' );
ylabel('y[n]');
3. 设离散系统可由下列差分方程表示:y [n ]-y [n -1]+0.9y [n -2]=x [n ]
1) 计算n =[-20:100]时的系统冲激响应;
a=[1,-1,0.9];
b=1;
x=cos(0.08*pi*n)+cos(0.8*pi*n);
n=[0:300];
h=filter(b,a,x);
figure(1)
subplot(2,1,1);stem(n,h)
axis(0,300,-1.1,1.1])
title('Impulse Response');
xlabel('n');
ylabel('h(n)')
(2)
x=stepseq(0,-20,100);
s=filter(b,a,x);
subplot(2,1,2);stem(n,s)
axis([-20,100,-0.5,2.5])
title('Step Response');xlabel('n');ylabel('s(n)')
figure(2)
impz(b,a)
实验七 连续时间系统分析
1. 设有两个稳定的LTI 系统,可分别由下列微分方程来描述:
dy (t ) +3y (t ) =3x (t ) dt 22d y (t ) dy (t ) d x (t ) b .3+4+y (t ) =+5x (t ) dt 2dt dt 2a .
请分别画出它们的系统频率响应的幅值和相位特性曲线。
Lab41a.m
a=[3 1];
b=3;
freqs(b,a);
0.2s 2+0.3s +12. 有一模拟滤波器,其传递函数为:H (s ) = 应用freqs 函数画出它的幅s 2+0.4s +1
频特性和相频特性曲线。
Lab42.m
a= [1 0.4 1];
b= [0.2 0.3 1];
freqs(b,a);