信号与系统实验报告4
- 格式:doc
- 大小:441.00 KB
- 文档页数:9
武汉大学教学实验报告
电子信息学院专业年月日实验名称指导教师
姓名年级学号成绩
(2)观察Gibbs 现象
分别取前10、20、30 和40 项有限级数来逼近奇对称方波,观察Gibbs 现象时得到的图如下
绘制周期信号的频谱
分析奇对称方波信号与偶对称三角信号的频谱,编制程序后画出图像如下所示(左上坐下分别为周期三角波及其频谱,右上右下为周期方波及其频谱)
2.实验操作过程
附件——matlab源文件
实验三
%周期三角信号的傅里叶级数
%author郑程耀
clear all;clc;
t=0:0.00001:0.04;
period=0.02;%周期
amplitude=1;%振幅
AC_coe=(4*amplitude)/(pi^2);%交流分量的系数
DC_coe=amplitude/2;%直流分量的系数
fre_w=(2*pi)/period;%圆频率
p=[1 2 5 100];
%t_z=0:0.01:t(end); %最简单的三角波
z=abs(sawtooth(t*(pi/period), 0.5)); %
figure
for ind_p=1:length(p)
y=DC_coe;
for k=1:p(ind_p)
y=y+DC_coe*cos((2*k-1)*fre_w*t)/(2*k-1)^2; end
subplot(2,2,ind_p)
plot(t,y)
hold on
plot(t,z,'r')
axis([0,0.04,-0.5,1.5]);
xlabel('time');
ylabel(strcat('前',num2str(p(ind_p)) ,'项有限级数')); end
实验四
%直接用公式计算各频率分量的振幅,并将他们画出来
%周期三角信号,方波信号的傅里叶级数
%author:郑程耀
clear all;clc;
period=0.02;%周期
t=0:0.00001:0.04;
N=15;
fre_n=1:2:2*N-1;
fre_n=[0 fre_n];
amplitude=1;%振幅
AC_coe=(4*amplitude)/(pi^2);%交流分量的系数
DC_coe=amplitude/2;%直流分量的系数
amplitude_w=DC_coe;
for k=1:length(fre_n)-1
amplitude_k=AC_coe/(2*k-1)^2;
amplitude_w=[amplitude_w amplitude_k];
end
figure
subplot(223)
stem(fre_n,amplitude_w,'*')
axis([-5 fre_n(end) 0 max(amplitude_w)*1.1])
title('三角波频谱')
xlabel('w')
ylabel('幅值')
%三角波波形
z=abs(sawtooth(t*(pi/period), 0.5)); %
subplot(221)
plot(t,z,'r')
title('三角波波形')
xlabel('time')
ylabel('amplitude')
%周期方波信号傅里叶级数
amplitude=6;%振幅
AC_coe=2*amplitude/pi ;%交流分量的系数
DC_coe=0;%直流分量的系数
amplitude_w=zeros(1,length(fre_n));
amplitude_w(1)=DC_coe;
for k=1:length(fre_n)-1
amplitude_k=AC_coe/(2*k-1);
amplitude_w(k+1)=amplitude_k;
end
subplot(224)
stem(fre_n,amplitude_w,'*')
axis([-5 fre_n(end) 0 max(amplitude_w)*1.1])
title('方波频谱')
xlabel('w')
ylabel('幅值')
%方波波形
subplot(222)
z_s=3*stepfun(t,0)-6*stepfun(t,0.01)+6*stepfun(t,0.02)-6*stepfun(t,0.03)+3*stepfun(t,0.04); plot(t,z_s)
title('方波波波形');
axis([0 0.04 -3.5 3.5])
xlabel('time')
ylabel('amplitude')