信号与系统MATLAB实验 下载本文

内容发布更新时间 : 2024/5/4 6:51:30星期一 下面是文章的全部内容请认真阅读。

波形图如下:

2x(n)?(?1/2)u(n) ○

nMATLAB 程序如下: n=-3:6; >> y=(n>=0); >> x=(-0.5).^n.*y; >> stem(n,x,'filled') 波形图如下:

3x(n)?n[u(n)?u(n?5)] ○

MATLAB 程序如下: >> n=-2:6;

>> x=n.*((n>=0)-(n>=5));

>> stem(n,x,'filled') 波形图如下:

4x(n)?sin(n?/2)u(n) ○

MATLAB 程序如下: n=-1:6;

>> x=sin(n.*pi.*0.5).*(n>=0); >> stem(n,x,'filled') 波形图如下:

(3)利用MATLAB生成并绘制连续周期矩形波信号,要求周期为2,峰值为3,显示三个周期的波形。

利用MATLAB 提供的square 函数来生成方波信号 MATLAB 程序如下:

> t=0:0.00001:6; >> x=3*square(pi*t); >> plot(t,x) 波形图如下:

(4)已知信号x1(t),及信号x2(t)?sin(2?t),用MATLAB绘出下列信号的波形。 由教材上x1(t)的波形可知x1(t)为一个三角波的右半部分。 1x(t)?x(t)?x(t) ○

3122x4(t)?x1(t)?x2(t) ○3x○

5?x1(?t)?x1(t)

234x(t)?x(t)?x(t?1) ○

6MATLAB 程序如下: syms t

x1=(4-t)*(heaviside(t)-heaviside(t-4)); x2=sin(2*pi*t); x3=x1+x2; x4=x1*x2;

xa=(4-(-t))*(heaviside(-t)-heaviside(-t-4)); x5=xa+x1;

x6=x2*subs(x3,t,t-1);

>> subplot(2,2,1);explot(x3,[-5,5]); >> subplot(2,2,1);ezplot(x3,[-5,5]);

>> subplot(2,2,2);ezplot(x4,[-5,5]); >> subplot(2,2,3);ezplot(x5,[-5,5]); >> subplot(2,2,4);ezplot(x6,[-5,5]) >> 波形如下:

(5)已知离散时间信号x(n),用MATLAB绘出x(n),x(?n),x(n?2)和x(n?2)的波形。

,3,3,3} 由教材上x(n)的波形可知x(n)?{1,2,3?1x(n) ○2x(?n) ○3x(n?2) ○4x(n?2) ○

MATLAB 程序如下: >> n=-6:6;

x1=(n+3).*[(n>=-2)-(n>=1)]+3.*[(n>=1)-(n>=4)]; stem(n,x1,'filled'); >> n=-6:6; >> n=-n; >> x2=x1;

>> stem(n,x2,'filled'); >> n=-6:6; >> n=n+2; >> x3=x1;

>> stem(n,x3,'filled'); >> n=-6:6; >> n=n-2; >> x4=x1;

>> stem(n,x4,'filled');

>>

波形如下: