北京交通大学《信号与系统》 课后matlab作业

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Matlab课后作业
1.M2-1
(1)Matlab程序:
t=-5:0.01:5;
x=(t>0)-(t>2);
plot(t,x);
axis([-5,5,-2,2]);
仿真结果:
(8)Matlab程序:
t=-10:0.01:10;
pi=3.14;
x=sin(pi*t)./(pi*t).*cos(30*t);
plot(t,x);
仿真结果:
M2-2
Matlab程序:
t=-2:0.001:2;
x=(t>-1)-(t>0)+2*tripuls(t-0.5,1,0); plot(t,x);
axis([-2,2,-2,2]);
仿真结果:
M3-3
(1)function yt=f(t)
yt=t.*(t>0)-t.*(t>=2)+2*(t>=2)-3*(t>3)+(t>5); (2)Matlab程序:
t=-10:0.01:11;
subplot(3,1,1);
plot(t,f(t));
title('x(t)');
axis([-1,6,-2,3]);
subplot(3,1,2);
plot(t,f(0.5*t));
axis([-1,11,-2,3]);
title('x(0.5t)');
subplot(3,1,3);
plot(t,f(2-0.5*t));
title('x(2-0.5t)');
axis([-9,5,-2,3]);
仿真结果:
M2-9
(1)Matlab程序:
k=-4:7;
x=[-3,-2,3,1,-2,-3,-4,2,-1,4,1,-1]; stem(k,x);
仿真结果:
(2)Matlab程序:
k=-12:21;
x=[-3,-2,3,1,-2,-3,-4,2,-1,4,1,-1]; N=length(x);
y=zeros(1,3*N-2);
y(1:3:end)=x;
stem(k,y);
仿真结果:
Matlab程序:
k=-1:3;
x=[0,0,-3,-2,3,1,-2,-3,-4,2,-1,4,1,-1]; x1=x(1:3:end);
stem(k-1,x1);
仿真结果:
(3)Matlab程序:
k=-6:5;
x=[-3,-2,3,1,-2,-3,-4,2,-1,4,1,-1]; stem(k,x);
仿真结果:
程序
>> k=-2:9;
>> x=[-3,-2,3,1,-2,-3,-4,2,-1,4,1,-1]; >> stem(k,x);
结果
程序
>> k=-4:7;
>> x=[-3,-2,3,1,-2,-3,-4,2,-1,4,1,-1]; >> xk=fliplr(x);
>> k1=-fliplr(k);
>> stem(k1,xk);
结果
M3-1
(1)程序
>> ts=0;te=5;dt=0.01; >> sys=tf([2 1],[1 3 2]); >> t=ts:dt:te;
>> x=exp(-3*t).*(t>=0); >> y=lsim(sys,x,t);
>> plot(t,y);
>> xlabel('Time(sec)') >> ylabel('y(t)')
结果
(2)程序
>> ts=0;te=5;dt=0.0001; >>sys=tf([2 1],[1 3 2]); >>t=sys:dt:te;
>>x=exp(-3*t).*(t>=0); >>y=lsim(sys,x,t);
>>plot(t,y);
>>xlabel('Time(sec)') >>ylabel('y(t)')
结果
M3-4
>> x=[0.85,0.53,0.21,0.67,0.84,0.12]; >> k1=-2:3;
>> h=[0.68,0.37,0.83,0.52,0.71];
>> k2=-1:3;
>> y=conv(x,h);
>> k=(k1(1)+k2(1)):(k1(end)+k2(end)); >> stem(k,y)
结果
M6-1
(1)>> num=[16 0 0];
>> den=[1 5.6569 816 2262.7 160000]; >> [r,p,k]=residue(num,den)
得r =
0.0992 - 1.5147i
0.0992 + 1.5147i
-0.0992 + 1.3137i
-0.0992 - 1.3137i
p =
-1.5145 +21.4145i
-1.5145 -21.4145i
-1.3140 +18.5860i
-1.3140 -18.5860i
k =
[]
所以可得 X(s)=j s j j s j j s j 5860.183140.13137.10992.05860.183140.13137.10992.04145.215145.15147.10992.021.4145j -1.5145s j 5147.1-0992.0++--+-++-++++++
x(t)=3.0108e-1.5145tcos(21.4145t-1.5054)u(t)+2.635e-1.314tcos(18.586t+1.6462)u(t ) (2)X(s)=)2552^)(5(2
^+++s s s s
解:>> num=[1 0 0 0];
den=conv([1 5],[1 5 25]);
[r,p,k]=residue(num,den)
[angle,mag]=cart2pol(real(r),imag(r))
得r =
-5.0000 + 0.0000i
-2.5000 - 1.4434i
-2.5000 + 1.4434i
p =
-5.0000 + 0.0000i
-2.5000 + 4.3301i
-2.5000 - 4.3301i
k =
1
angle =
3.1416
-2.6180
2.6180
mag =
5.0000
2.8868
2.8868
所以X(s)=3301.45.24434.15.23301.45.24434.15.25s 5.0-1j s j j s j +++-+-+--+++
x(t)=δ(t)+5e-5tu(t)+5.7736e-2.5tcos(4.3301t-2.618)u(t)
M6-2
程序
>> t=0:0.1:10;
>> y1=(2.5*exp(-t)-1.5*exp(-3*t)).*(t>=0);
>> y2=((1/3)+2*exp(-t)-(5/6)*exp(-3*t)).*(t>=0);
>> y=((1/3)+(9/2)*exp(-t)-(7/3)*exp(-3*t)).*(t>=0);
>> plot(t,y1,'r-',t,y2,'g--',t,y,'b-')
>> xlabel('Time');
>> legend('零输入响应','零状态响应','完全响应')
结果
M6-5
>> num=[1 2];
>> den=[1 2 2 1];
>> sys=tf(num,den);
>> pzmap(sys)
>> num=[1 2];
den=[1 2 2 1];
[r,p,k]=residue(num,den) [angle,mag]=cart2pol(real(r),imag(r))
1.0000 + 0.0000i
-0.5000 - 0.8660i
-0.5000 + 0.8660i
p =
-1.0000 + 0.0000i
-0.5000 + 0.8660i
-0.5000 - 0.8660i
k =
[]
angle =
-2.0944
2.0944
mag =
1.0000
1.0000
1.0000
所以H(s)=866.05.0866.05.0866.05.0866.05.01s 1j s j j s j +++-+
-+--++
系统冲激响应h(t)=e-tu(t)+2e-0.5tcos(0.866t-2.0944)u(t)
>> num=[1 2];
>> den=conv([1 0],[1 2 2 1]);
>> [r,p,k]=residue(num,den)
r =
-1.0000 + 0.0000i
-0.5000 + 0.8660i
-0.5000 - 0.8660i
2.0000 + 0.0000i
p =
-1.0000 + 0.0000i
-0.5000 + 0.8660i
-0.5000 - 0.8660i
0.0000 + 0.0000i
k =
[]
[angle,mag]=cart2pol(real(r),imag(r))
angle =
3.1416
2.0944
-2.0944
mag =
1.0000
1.0000
1.0000
2.0000
所以Y(s)=
s j s j j s j 2866.05.0866.05.0866.05.0866.05.0-1s 1-+++--+-++++ 系统阶跃响应y(t)=e-tu(t)+2e-0.5tcos(0.866t+2.0944)u(t)
因为系统的冲激响应
h(t)=e-tu(t)-1.00001e-0.5tcos(0.866t)u(t)+1.73205e-0.5tsin(0.866t)u(t) 所以系统的频率响应
H(j ω)=
5.0)86
6.0(866.05.0)866.0(866.05.0)866.0(5.05.0)886.0(5.01j 1j j j j ++--+--++-+++++ωωωωω。

相关文档
最新文档