信号分析与处理仿真实验
- 格式:docx
- 大小:669.00 KB
- 文档页数:12
实验报告
实验名称MATLAB仿真实验
课程名称信号分析与处理
院系部: 专业班级:学生姓名:学号:同组人:实验台号:指导教师:成绩:实验日期:2015-11-29
实验一信号的产生与运算
1.单位阶跃信号
(1)源程序
t=-0.5:0.01:1.5;
u=stepfun(t,0);
u1=stepfun(t,0.5);
figure(1)
plot(t,u);axis([-0.5 1.5 -0.2 1.2]);title('单位阶跃信号波形'); figure(2)
plot(t,u1);axis([-0.5 1.5 -0.2 1.2]);title('延迟单位阶跃信号波形'); (2)实验结果
2.单位冲激信号
(1)源程序
clear;clc;
t=-1:0.001:1;
for i=1:3
dt=1/(i^4);
x=(1/dt)*((t>=-(1/2*dt))-(t>=(1/2*dt))); subplot(1,3,i);
stairs(t,x);
end
(2)实验结果
3.抽样信号
(1)源程序
clear;clc;
t=-20:0.01:20;
x=sinc(t/pi);
plot(t,x); title('抽样信号'); (2)实验结果
4.单位样值序列(1)源程序
clear;clc;
n1=input('n1=');
n2=('n2=');
n=n1:n2;
k=length(n);
x1=zeros(1,k);
x1(1,-n1+1)=1 subplot(1,2,1); stem(n,x1,'filled')
(2)实验结果
信号运算的MATLAB实现
连续信号的运算
例9-1
(1)源程序
t=-3:0.01:3;
u=(t+1).*((t>-1)-(t>0))+(t>0)-(t>1);
figure(1)
plot(t,u);axis([-3 3 -0.2 1.2]);title('x(t)');
u2=(-t+1).*((-t>-1)-(-t>0))+(-t>0)-(-t>1);
figure(2)
plot(t,u2);axis([-3 3 -0.2 1.2]);title('x(-t)'); (2)实验结果
序列的运算
例9-4
(1)源程序
n=0:8;
x1=[1 0 2 4 3 -1 2 3 0];
subplot(2,2,1);
stem(n,x1,'filled');
axis([-1,9,-2,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,-2,5]);
title('x2(n)');
x3=x1+x2;
subplot(2,2,3);
stem(n,x3,'filled');
axis([-1,9,-2,13]);
title('x1(n)+x2(n)');
(2)实验结果
实验二连续时间信号的分析
1.连续时间信号的复频域分析
用MATLAB求解信号的laplace变换与反变换
例9-11
(1)源程序
syms t a;
x1t=exp(-a*t);
x2t=cos(2*t);
x1s=laplace(x1t);
x2s=laplace(x2t);
(2)实验结果
>> x1s
x1s =
1/(s+a)
>> x2s
x2s =
s/(s^2+4)
例9-12
(1)源程序
syms s;
xs=s^2/(s^2+3*s+2);
xt=ilaplace(xs,s,t)
(2)实验结果
xt =
dirac(t)-4*exp(-2*t)+exp(-t)
2.连续时间信号的频域分析
用MATLAB求解非周期信号的傅里叶变换
例9-20
(1)源程序
syms s t w;
x=1/2*exp(-2*t)*sym('Heaviside(t)');
X=fourier(x)
subplot(1,2,1);ezplot(x)
subplot(1,2,2);ezplot(abs(X))
(2)实验结果
实验三离散时间信号的分析
1.离散时间信号的频谱分析
用matlab求解离散时间信号傅里叶变换
例9-23
(1)源程序
clc;clear;
n=-5:5;
x=(-0.9).^n;k=-200:200;
w=(pi/100)*k;
X=x*(exp(-j*pi/100)).^(n'*k);
magX=abs(X);
angX=angle(X);
subplot(2,1,1);plot(w/pi,magX);
axis([-2,2,0,15]);xlabel('\Omega/(\pi)');ylabel('幅度'); subplot(2,1,2);plot(w/pi,angX)/pi;
axis([-2,2,-4,4]);xlabel('\Omega/(\pi)');ylabel('相位/(\pi)'); (2)实验结果
X=(-0.9)^n,-5<=n<=5 的离散傅里叶变换
用FFT的结果分析模拟信号的频谱
例9-24
(1)源程序
clcl;clear;
t=0:0.02/64:0.04;
f1=50;
y1=cos(2*pi*f1*t)+0.5*cos(2*pi*3*f1*t)+0.3*cos(2*pi*5*f1*t); subplot(311);plot(t,y1);
t=0:0.02/16:0.02-0.02/16;
f=cos(2*pi*f1*t)+0.5*cos(2*pi*3*f1*t)+0.3*cos(2*pi*5*f1*t);
F_1024=2*abs(fft(f,16))/16;
k=0:1:15;
subplot(312);stem(k,abs(F_1024));