信号与系统Matlab课程设计报告 下载本文

内容发布更新时间 : 2024/12/23 18:30:26星期一 下面是文章的全部内容请认真阅读。

南通大学罗开元

已知信号f(t)=(1+t/2)*(u(t+2)-u(t-2)),用matlab求f(t+2),f(t-2),f(-t).f(2t),-f(t),并绘出时域波形。

Command Window

syms t;

f=sym(‘(t/2+1)*(Heaviside(t+2)- Heaviside(t-2))’); subplot(2,3,1);ezplot(f,[-3,3]); y1=subs(f,t,t+2);

subplot(2,3,2);ezplot(y1,[-5,1]); y2=subs(f,t,t-2);

subplot(2,3,3);ezplot(y2,[-1,5]); y3=subs(f,t,-t);

subplot(2,3,4);ezplot(y3,[-3,3]); y4=subs(f,t,2*t);

subplot(2,3,5);ezplot(y4,[-2,2]); y5=-f;

subplot(2,3,6);ezplot(y5,[-3,3]); 仿真结果如下图所示:

4

南通大学罗开元

2、信号的卷积

(1)f(t)=f1(t)*f2(t)

function [k,f]=myconv(f1,f2,k1,k2,p) f=conv(f1,f2)*p; k0=k1(1)+k2(1);

k3=length(f1)+length(f2)-2; k=k0:p:k0+k3*p;

(2)求x1=e?t??(t)?和x2=δ(t+3)+δ(t-3)的卷积x1(t)*x2(t),并-?(t-2)验证卷积的性质。

Command Window

[t1,f11]=jieyue(-8,8,0);[t1,f12]=jieyue(-8,8,2); f1=f11-f12; x1=exp(-t1).*f1;

[t2,f21]=chongji(-8,8,-3);[t2,f22]=chongji(-8,8,3);

5

南通大学罗开元

x2=f21+f22;

subplot(3,1,1);plot(t1,x1); subplot(3,1,2);plot(t2,x2); [t3,f]=myconv(x1,x2,t1,t2,0.01) subplot(3,1,3);plot(t3,f); 仿真结果:

?1,0?t?2(3)已知f,f(?e?2t,0<=t<=10的卷积f(t)=f1(t)*f2(t)的(t)??2t)1??1,2?t?3时域波形图。

Command Window

t11=0; t12=3; t21=0; t22=10;

t1=t11:0.001:t12;

6

南通大学罗开元

ft1=-sign(t1-2); t2=t21:0.001:t22; ft2=exp(-2*t2);

t=t11+t21:0.001:t12+t22; ft=conv(ft1,ft2); ft=ft*0.001; subplot(2,2,1); plot(t1,ft1); title('f1(t)'); subplot(2,2,2); plot(t2,ft2); title('f2(t)'); subplot(2,2,3); plot(t,ft);

title('f1(t)*f2(t)'); 仿真结果:

7

南通大学罗开元

例:已知两个信号f1(t)=u(t-1)-u(t-2),f2(t)=u(t)-u(t-1),求f(t)=f1(t)*f2(t)的时域波形图。

Command Window

t1=1; t2=2; t3=0; t4=1; t=0:T:t2+t4;

x1=ones(size(t)).*((t>t1)-(t>t2)); x2=ones(size(t)).*((t>t3)-(t>t4)); y=conv(x1,x2)*T;

subplot(3,1,1),plot(t,x1); ylabel('x1(t)');

subplot(3,1,2),plot(t,x2); ylabel('x2(t)');

subplot(3,1,3),plot(t,y(1:(t2+t4)/T+1)); ylabel('y(t)=x1*x2'); xlable('---t/s');

仿真结果:

8