信号与系统(山东大学张国霞)实验六: 傅里叶分析方法的应用

一、实验目的

1)学会运用MATLAB完成频响函数的对数幅频特性与相频特性绘制。

2)学会运用MATLAB完成信号抽样及对抽样信号的频谱分析。

3)学会运用MATLAB对抽样后的信号进行重建。

4)了解运用MATLAB的其他傅里叶分析应用。

二、实验设备

(1)计算机。

(2)MATLAB软件。

三、实验内容

 

[success]

1.频响函数

7-1

[/success]

 

[info](1)[/info]

omega=logspace(-3,1,500); %生成从0.001到10之间按对数等分的500个元素的行向量
h=1./(1+i*10*omega);
figure; %新窗口,参数默认
subplot(2,1,1)
semilogx(omega,20*log10(abs(h))) %绘制对数幅频特性
title('例题7-1(1)')
grid on;
subplot(2,1,2); 
semilogx(omega,angle(h));%绘制相频特性
grid on;

[info](2)[/info]

w=0:0.02:100;
magHw=abs(i.*w./(1-w.^2+i.*w));
semilogx(w,magHw);  %绘制对数幅频特性
xlabel('Frequency in rad/sec-log scale');
ylabel('Magnitude of Vout/Vin'); 
title('例题7-1(2)')
grid ;

 

[success]

2.信号抽样及抽样定理

例7-2

[/success]

%取E=1,tao=pi,Ts=1
s=1;
dt=0.1;
t1=-4:dt:4;
ft=((1+cos(t1))/2).*( heaviside(t1+pi)-heaviside(t1-pi)); 
subplot(221)
plot(t1,ft),grid on
axis([-4 4 -0.1 1.1])  %x轴和y轴限制范围
xlabel('Time(sec)'),ylabel('f(t)');
title('升余弦脉冲信号')
N=500;
k=-N:N;
W=pi*k/(N*dt);
Fw=dt*ft*exp(-j*t1'*W);  %求傅里叶变换
subplot(222)
plot(W,abs(Fw)),grid on
axis([-10 10 -0.2 1.1*pi])
xlabel('\omega'),ylabel('F(w)');
title('升余弦脉冲信号的频谱')
Ts=1;
t2=-4:Ts:4;
fst=((1+cos(t2))/2).*(heaviside(t2+pi)-heaviside(t2-pi)); 
subplot(223)
plot(t1,ft,':'),hold on
stem(t2,fst),grid on  %间隔Ts=1抽样
axis([-4 4 -0.1 1.1])
xlabel('Time(sec)'),ylabel('fs(t)');
title('抽样后的信号'),hold off
Fsw=Ts*fst*exp(-j*t2'*W);  %求傅里叶变换
subplot(224)
plot(W,abs(Fsw)),grid on
axis([-10 10 -0.2 1.1*pi])
xlabel('\omega'),ylabel('Fs(w)');
title('抽样后的信号的频谱')

[success]

例7-4

[/success]

wm=2;
wc=1.2*wm;
Ts=1;
n=-100: 100;
nTs=n*Ts;
fs=((1+cos(nTs))/2).*(heaviside(nTs+pi)-heaviside(nTs-pi)); 
t=-4:0.1:4;
ft=fs*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t)))); 
t1=-4:0.1:4;
f1=((1+cos(t1))/2).*(heaviside(t1+pi)-heaviside(t1-pi));
subplot(311)
plot(t1,ft,':'),hold on 
stem(nTs,fs),grid on  %间隔Ts=1抽样
axis([-4 4 -0.1 1.1])
xlabel('nTs'),ylabel('f(nTs)');
title('抽样间隔Ts=1时的抽样信号f(nTs)')
hold off
subplot(312)
plot(t,ft),grid on
axis([-4 4 -0.1 1.1])
xlabel('t'),ylabel('f(t)');
title('由f(nTs)信号重建得到升余弦脉冲信号')
error=abs(ft-f1);  %求重建信号与原升余弦脉冲信号的绝对误差
subplot(313)
plot(t,error),grid on
xlabel('t'),ylabel('error(t)');
title('重建信号与原升余弦脉冲信号的绝对误差')

[success]

3.调制与解制

例7-5

[/success]

clear clc
fs=40;
Fs=400;
Fc=40;
N=400;
n=0:N;
t=n/Fs;
xt=cos(2*pi*5*t);
xct=cos(2*pi*Fc*t);
yt=xt.*xct;
Xw=fftshift(abs(fft(xt,512)));
Yw=fftshift(abs(fft(yt,512)));
ww=-256:255;
ww=ww*Fs/512;
figure,subplot(2,1,1),plot(t,xt),title('调制信号波形')
subplot(2,1,2),plot(ww,Xw),title('调制信号频谱')
figure,subplot(2,1,1),plot(t,yt),title('已调信号波形')
subplot(2,1,2),plot(ww,Yw),title('已调信号频谱')
y1t=yt.*xct;
figure,subplot(2,1,1),plot(t,y1t),title('解调过程中间信号波形')
Y1w=fftshift(abs(fft(y1t,512)));
subplot(2,1,2),plot(ww,Y1w),title('解调过程中间信号频谱')
h=fir1(20,40/200,hamming(21));
figure,freqz(h,1),title('滤波器频率特性')
y2t=filter(h,1,y1t);
Y2w=fftshift(abs(fft(y2t,512)));
figure,subplot(2,1,1),plot(t,y2t),title('解调信号的波形')
subplot(2,1,2),plot(ww,Y2w),title('解调信号的频谱')

[success]

4.单边带信号

[/success]

t=0:0.01:4.2;
t1=0:0.01:2.1;
t2=0:0.01:2.09;
f=ones(size(t)).*(t<0.5);
wc=100;
fa=f.*cos(wc*t);
ga=fft(fa);
h1=[j*ones(size(t1))];
h2=[-j*ones(size(t2))];
h=[h1 h2];
g=fft(f).*h;
fb=ifft(g);
fc=fb.*sin(wc*t);
gc=fft(fc);
y1=ga+gc;

y2=ga-gc;
subplot(4,1,1),plot(abs(ga));
subplot(4,1,2),plot(abs(gc));
subplot(4,1,3),plot(abs(y1));
subplot(4,1,4),plot(abs(y2));

© 版权声明
THE END
喜欢就支持以下吧
点赞3赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容