南通大学罗开元
t=[t1,t2,t3];
f=[zeros(1,length(t1)),ones(1,length(t2)),zeros(1,length(t3))]; m0=5;
f1=[zeros(1,m0),f];f2=f1(1:length(f)) w=-2*pi:0.1:2*pi; F=f*exp(-j*t'*w)*dt;
subplot(2,2,1);plot(w,abs(F));grid; subplot(2,2,2);plot(w,angle(F));grid; F2=f2*exp(-j*t'*w)*dt;
subplot(2,2,3);plot(w,abs(F2));grid; subplot(2,2,4);plot(w,angle(F2));grid; 仿真结果:
19
南通大学罗开元
频移性质:
Command Window
dt=0.1; N=500; door__width=10; tao=door__width/2; t1=-(N-1):dt:-tao+1; t2=-tao:dt:tao; t3=tao-1:dt:N-1; t=[t1,t2,t3];
f=[zeros(1,length(t1)),ones(1,length(t2)),zeros(1,length(t3))]; w1=0.5*pi;
f2=f.*exp(-j*w1*t); w=-2*pi:0.1:2*pi; F=f*exp(-j*t'*w)*dt;
subplot(2,2,1);plot(w,abs(F));grid; subplot(2,2,2);plot(w,angle(F));grid; F2=f2*exp(-j*t'*w)*dt;
subplot(2,2,3);plot(w,abs(F2));grid; subplot(2,2,4);plot(w,angle(F2));grid; 仿真结果:
20
南通大学罗开元
(3)画出g(*g(的频谱图,验证时域卷积定理。 ?t)?t)Command Window
dt=0.1;N=50; door__width=8; tao=door__width/2; t1=-(N-1):dt:-tao+dt; t2=-tao:dt:tao; t3=tao-dt:dt:N-1; t=[t1,t2,t3];
f=[zeros(1,length(t1)),ones(1,length(t2)),zeros(1,length(t3))]; [k,f2]=myconv(f,f,t,t,dt) subplot(2,2,1);stairs(t,f); subplot(2,2,2);plot(k,f2); w=-2*pi:0.1:2*pi;
21
南通大学罗开元
F=f*exp(-j*t'*w)*dt;
subplot(2,2,3);plot(w,abs(F));grid; F2=f2*exp(-j*t'*w)*dt;
subplot(2,2,4);plot(w,abs(F2));grid; 得到波形如下图所示:
(4)画出g(和?Sa(? t/2)的频谱图,比较两者的联系,验证傅里叶变换的对?t)称性;
Command Window
dt=0.03;N=10; door__width=10; tao=door__width/2; t1=-(N-1):dt:-tao-dt; t2=-tao:dt:tao; t3=tao-dt:dt:N-1; t=[t1,t2,t3];
22
南通大学罗开元
f=[zeros(1,length(t1)),ones(1,length(t2)),zeros(1,length(t3))]; subplot(2,2,1);stairs(t,f);grid;title('门函数波形'); f2=10*sin(5*t)./(5*t);
subplot(2,2,2); plot(t,f2);grid;title('Sa函数波形'); w=-2*pi:0.1:2*pi; F=f*exp(-j*t'*w)*dt;
subplot(2,2,3);plot(w,real(F));grid;title('门函数频谱'); F2=f2*exp(-j*t'*w)*dt;
subplot(2,2,4);plot(w,real(F2));grid;title('Sa函数频谱'); 仿真结果:
(5)画sin(2?t)和g?(t)sin(2?t)的振幅频谱图,验证频域卷积定理。
Command Window
dt=0.01;N=20; door_width=5; tao=door_width/2;
23