n2=input(‘输入序列的起点n2=’); n=n1:n2;k=length(n); x1=zeros(1,k);x1(1,-n1+1)=1; subplot(1,2,1);stem(n,x1,’filled’) x2=zeros(1,k);x2(1,-n1+1:n2-n1+1)=1 subplot(1,2,2);stem(n,x2,’filled’)
(3)已知x1=[1 0 2 4 3 -1 2 3 0],x2=[0 0 0 2 3 1 2 4 3],用MATLAB绘制出x1、x2、x1+x2、x1.*x2的波形图,MATLAB 程序如下: n=0:8;
x1=[1 0 2 4 3 -1 2 3 0];
subplot(2,2,1);stem(n,x1,’filled’); axis([-1,9,-4,5]);title(‘x1(n)’); x2=[0 0 0 2 3 1 2 4 3];
subplot(2,2,2);stem(n,x2,’filled’); axis([-1,9,-4,5]);title(‘x2(n)’); x3=x1+x2;
subplot(2,2,3);stem(n,x3,’filled’); axis([-1,9,-4,9]);title(‘x3(n)=x1(n)+x2(n)’); x4=x1.*x2;
subplot(2,2,4);stem(n,x4,’filled’); axis([-1,9,-4,15]);title(‘x4(n)=x1(n)*x2(n)’);
(4)已知连续时间信号f(t)的时域波形如图所示,试用MATLAB绘制f(t-1)、
f(2t-2)、f(-2t?2)的时域波形。
clc;clear all;syms t;
ft=2*(heaviside(t+2)-heaviside(t))+(heaviside(t)-heaviside(t-2))*(2-t); figure(1);
subplot(2,2,1);ezplot(ft;[-4,4]);title(‘f(t)’);axis([-4,4,-1,3]); ft3=subs(ft,t,t-1);
subplot(2,2,3);ezplot(ft3,[-4,4]);title(‘f(t-1)’);axis([-4,4,-1,3]); ft1=subs(ft,t,2*t-2);
subplot(2,2,2);ezplot(ft1,[-4,4];title(‘f(2t-2)’);axis([-4,4,-1,3]); ft2=subs(ft,t,-2*t+2);
subplot(2,2,4);ezplot(ft2,[-4,4]);title(‘f(2t-2)’);axis([-4,4,-1,3]);
四、实验心得体会
实验2 信号频域分析
一、实验目的
1.深入理解信号频谱的概念,掌握信号的频域分析方法。 2.观察典型周期信号和非周期信号的频谱,掌握其频谱特性。 二、实验原理
1.连续周期信号的频谱分析
如果周期信号满足狄里赫利条件,就可以展开为傅里叶级数形式,即
f(t)?n????cen??jn?1t(1)
1cn??f(t)e?jn?1tdtT1T1T1(2)式中,T1表示基波周期,?1为基波频率,(?)表示任一个基波周期内的积分。
?式(1)和式(2)定义为周期信号复指数形式的傅里叶级数,系数cn称为f(t)的傅里叶系数。周期信号的傅里叶级数还可以由三角函数的线性组合来表示,即
f(t)?a0?其中,a0?1f(t)dt?T1T1?an?1??ncosn?1t??bnsinn?1tn?1??(3)
an?2?f(t)cosn?1tdtT1T1bn?