信号与系统实验报告
实验名称:信号与系统实验
实验地点:xxxxxxxxxxxxxxxxx
软件版本:MATLAB7.0
实验时间: 2013.xx.xx —2013.xx.xx
学号: 20xxxxxx
姓名: xxxx
一、实验目的
1.掌握用matlab软件产生基本信号的方法。
2.应用matlab软件实现信号的加,减,乘,反折,移位 ,尺度变换及卷积运算。
二、实验原理
(一)产生信号波形的方法
利用 Matlab 软件的信号处理工具箱(Signal Processing Toolbox)中的专用函数产生信号并 绘出波形 a.产生正弦波 t=0:0.01:3*pi; y=sin(2*t); plot(t,y)
10.80.60.40.20-0.2-0.4-0.6-0.8-1012345678910
b.产生叠加随机噪声的正弦波 t=0:0.01:3*pi; y=10*sin(2*t);
s=y+randn(size(t)); plot(t,s)
151050-5-10-15012345678910
c. 产生周期方波 t=0:0.01:1;
y=square(4*pi*t);
plot(t,y)
10.80.60.40.20-0.2-0.4-0.6-0.8-100.10.20.30.40.50.60.70.80.91
d. 产生周期锯齿波 t=(0:0.001:2.5);
y=sawtooth(2*pi*30*t);
plot(t,y),axis([0 0.2 -1.1])
10.50-0.500.050.10.150.20.25
e.产生Sinc 函数
x=linspace(-5,5); y=sinc(x); plot(x,y)
10.80.60.40.20-0.2-0.4-5-4-3-2-1012345
f.产生指数函数波形
x=linspace(0,1,100); y=exp(-x);
plot(x,y)
10.90.80.70.60.50.400.10.20.30.40.50.60.70.80.91
(二)信号的运算
1.加(减)、乘运算 (要求二个信号序列长度相同) .例
t=0:0.01:2; f1=exp(-3*t);
f2=0.2*sin(4*pi*t); f3=f1+f2; f4=f1.*f2;
subplot(2,2,1);plot(t,f1);title('f1(t)'); subplot(2,2,2);plot(t,f2);title('f2(t)'); subplot(2,2,3);plot(t,f3);title('f1+f2'); subplot(2,2,4);plot(t,f4);title('f1*f2');
f1(t)10.80.600.40.2000.51f1+f210.50.30.20.10000.511.52-0.100.511.521.52-0.1-0.20.20.1f2(t)00.51f1*f21.52-0.5
2.用 matlab 的符号函数实现信号的反折、移位、尺度变换
由f(t)到 f(-at+b)(a>0)步骤:
f(t)移位f(t+b)尺度f(at+b)反折f(at+b)
例:已知 f(t)=sin(t)/t,试通过反褶、移位、尺度变换由 f(t)的波形得到 f(-2t+3) 的波形
syms t;
f=sym('sin(t)/t'); f1=subs(f,t,t+3); f2=subs(f1,t,2*t);
f3=subs(f2,t,-t);
subplot(2,2,1);ezplot(f,[-8,8]);grid on; subplot(2,2,2);ezplot(f1,[-8,8]);grid on; subplot(2,2,3);ezplot(f2,[-8,8]);grid on; subplot(2,2,4);ezplot(f3,[-8,8]);grid on;
sin(t)/t11sin(t+3)/(t+3)0.50.50-505tsin(2 t+3)/(2 t+3)0-505t-sin(2 t-3)/(-2 t+3)0.80.60.40.20-0.2-50t50.80.60.40.20-0.2-50t5
(三)卷积运算 Y=conv(x,h )
实现x,h 二个序列的卷积,假定都是从 n=0 开始.Y 序列的长度为 x,h 序列的长度之和再减1. 例
1:二个方波信号的卷积
y1=[ones(1,20),zeros(1,20)]; y2=[ones(1,10),zeros(1,10)]; y=conv(y1,y2); n1=1:length(y1); n2=1:length(y2); L=length(y);
subplot(3,1,1);plot(n1,y1);axis([1,L,0,2]); subplot(3,1,2);plot(n2,y2);axis([1,L,0,2]); n=1:L;
subplot(3,1,3);plot(n,y);axis([1,L,0,20]);
21021020100510152025303540455055510152025303540455055510152025303540455055
例
2:二个指数信号的卷积.