1、实验二 连续信号基本运算的MATLAB实现一、实验目的1、观察并熟悉连续信号的波形和特性。2、学会运用Matlab表示常用连续时间信号的基本运算。二、实验原理1)信号的基本加法和乘法运算f1=sin(t),f2=sin(t),f3=f1+f2,f4=f1*f2;% Program t=0:0.01:4*pi; f1=sin(t); f2= sin(t); f3=f1+f2;f4=f1.*f2;subplot(221);plot(t,f1);title(f1 signal);subplot(222);plot(t,f2);title(f2 signal);subplot(223);plot(t,
2、f3);title(f1+f2 signal);subplot(224);plot(t,f4);title(f1*f2 signal);运行后的结果:2)信号的时移x(t) = e-0.5tu(t),x1(t) = e-0.5(t+2)u(t+2),x2(t) = e-0.5(t-2)u(t-2)。% Programclear,close all,t = -5:0.01:5;x = exp(-0.5*t).*u(t); % Generate the original signal x(t)x1 = exp(-0.5*(t+2).*u(t+2); % Shift x(t) to the left
3、 by 2 second to get x1(t)x2 = exp(-0.5*(t-2).*u(t-2); % Shift x(t) to the right by 2 second to get x2(t)subplot(311)plot(t,x) % Plot x(t)grid on,title ( x = exp(-0.5*t).*u(t)subplot (312)plot (t,x1) % Plot x1(t)grid on,title ( x1 = exp(-0.5*(t+2).*u(t+2) )subplot (313)plot (t,x2) % Plot x2(t)grid on
4、,title ( x2 = exp(-0.5*(t-2).*u(t-2)xlabel (Time t (sec)程序运行结果: 3)信号的时域反褶m=sin(t);n=sin(-t);程序如下:t=0:0.01:4*pi;m=sin(t);subplot(121);plot(t,m);title(sin(t) signal);subplot(122);plot(-t,m);title(sin(-t) signal);程序运行结果:4)信号的时域尺度变换m=sin(t);n=sin(2t)t=0:0.01:4*pi;k=2*t;m=sin(t);s=sin(k);subplot(121);plo
5、t(t,m);title(sin(t) signal);subplot(122);plot(t,s);title(sin(2t) signal);程序运行结果:5)卷积的计算:conv调用格式:y= conv (x,h) 求两个有限长序列x,h的卷积注意:conv默认两个信号的时间序列从n=0开始,所以默认y对应的时间序号也从0开始。x(t) = tu(t)-u(t-8)和h(t) =2t u(t)-u(t-8)% Programt = 0:0.01:8;x = t;h =2*t;y =conv(x,h); % Compute the convolution of x(t) and h(t)subplot(221)plot(t,x), grid on, title(Signal x(t), subplot(222)plot(t,h), grid on, title(Signal h(t), subplot(212)t1 = 0:0.01:16; plot(t1,y), grid on, title(Signal y(t)axis(-1 1.1*max(t1) 1.1*min(y) 1.1*max(y)程序运行结果三、实验内容1熟悉实验原理的实例2.上机调试并打印或记录程序及实验结果。3.完成实验报告。