资源描述
大连理工大学
本科实验报告
课程名称:___信号与系统实验
学 院: 信息与通信工程学院
专 业: 电子信息工程
班 级:
学 号:
学生姓名:
2012年12月11日
信号与系统实验
项目列表
信号的频谱图
Signals Frequency Spectrum
连续时间系统分析
Analysis for Continuous-time System
信号抽样
Signal Sampling
离散时间LTI系统分析
Analysis for Discrete-time LTI System
语音信号的调制解调
Modulation and Demodulation for Audio Signals
Simulink®模拟信号的调制解调
Modulation and Demodulation for Analog Signals in Simulink ®
实验1 信号的频谱图
一、 实验目的
1. 掌握周期信号的傅里叶级数展开;
2. 掌握周期信号的有限项傅里叶级数逼近;
3. 掌握周期信号的频谱分析;
4. 掌握连续非周期信号的傅立叶变换;
5. 掌握傅立叶变换的性质。
二、 实战演练(5道题)
1. 已知周期三角信号如下图1-5所示,试求出该信号的傅里叶级数,利用MATLAB编程实现其各次谐波的叠加,并验证其收敛性。
解:
调试程序如下:
clc
clear
t=-2:0.001:2;
omega=pi;
y=-(sawtooth(pi*t,0.5)/2+0.5)+1;
plot(t,y),grid on;
xlabel('t'),ylabel('周期三角波信号');
axis([-2 2 -0.5 1.5])
n_max=[1 3 5 11 47];
N=length(n_max);
for k=1:N
n=1:2: n_max(k);
c=n.^2;
b=4./(pi*pi*c);
x=b*cos(omega*n'*t)+0.5;
figure;
plot(t,y,'b');
hold on;
plot(t,x,'r');
hold off;
xlabel('t'),ylabel('部分和的波形');
axis([-2 2 -0.5 1.5]);grid on;
title(['最大谐波数=',num2str(n_max(k))])
end
运行结果如下:
2. 试用MATLAB分析上图中周期三角信号的频谱。当周期三角信号的周期和三角信号的宽度变化时,试观察其频谱的变化。
解:
调试程序如下:
n=-30:30;
tao=1;T=10;w1=2*pi/T;
c=n.^2;
x=n*pi*tao/(2*T);
d=sin(x);
e=d.^2;
fn=8*e./(tao*c*4*pi*pi/T);
subplot(412)
stem(n*w1,fn),grid on;
title('tao=1,T=10');
hold on
stem(0,0.05);
tao=1;T=1;w0=2*pi/T;
c=n.^2;
x=n*pi*tao/(2*T);
d=sin(x);
e=d.^2;
fn=8*e./(tao*c*4*pi*pi/T);
m=round(30*w1/w0);
n1=-m:m;
fn=fn(30-m+1:30+m+1);
subplot(411)
stem(n1*w0,fn),grid on;
title('tao=1,T=1');
hold on
stem(0, 0.5);
tao=1;T=5;w2=2*pi/T;
c=n.^2;
x=n*pi*tao/(2*T);
d=sin(x);
e=d.^2;
fn=8*e./(tao*c*4*pi*pi/T);
m=round(30*w1/w2);
n1=-m:m;
fn=fn(30-m+1:30+m+1);
subplot(413)
stem(n1*w2,fn),grid on;
title('tao=1,T=5');
hold on
stem(0, 0.1);
tao=2;T=10;w3=2*pi/T;
c=n.^2;
x=n*pi*tao/(2*T);
d=sin(x);
e=d.^2;
fn=8*e./(tao*c*4*pi*pi/T);
subplot(414)
stem(n*w3,fn),grid on;
title('tao=2,T=10');
hold on
stem(0, 0.1);
运行结果如下:
从图中可以看出,脉冲宽度τ 越大,信号的频谱带宽越小;而周期越小,谱线之间间隔越大.
3. 试用MATLAB命令求下列信号的傅里叶变换,并绘出其幅度谱和相位谱。
解:
调试程序如下:
ft1=sym('sin(2*pi*(t-1))/(pi*(t-1))');
ft2=sym('(sin(pi*t)/(pi*t))^2');
Fw1=fourier(ft1);
Fw2=fourier(ft2);
subplot(411);
ezplot(abs(Fw1));grid on;
title('f1幅度谱');
phase=atan(imag(Fw1)/real(Fw1));
subplot(412);
ezplot(phase);grid on;
title('f1相位谱');
subplot(413);
ezplot(abs(Fw2));grid on;
title('f2幅度谱');
phase=atan(imag(Fw2)/real(Fw2));
subplot(414);
ezplot(phase);grid on;
title('f2相位谱');
运行结果如下:
4. 试用MATLAB命令求下列信号的傅里叶反变换,并绘出其时域信号图。
解:
调试程序如下:
clear;
syms t1;
syms omega;
Fw1 = fourier((10/(3+j*omega))-(4/(5+j*omega)));
ft1 = ifourier(Fw1,t1);
syms t2;
Fw2 = fourier(exp(-4*omega^2));
ft2 = ifourier(Fw2,t2);
subplot(211);
ezplot(t1,ft1);grid on;
title('f1时域信号');
subplot(212);
ezplot(t2,ft2);grid on;
title('f2时域信号');
5. 试用MATLAB数值计算方法求门信号的傅里叶变换,并画出其频谱图。门信号即
dt = 0.005;
t = -5:dt:5;
y1 = [t>=-0.5];
y2 = [t>=0.5];
ft = y1 - y2;
N = 2000;
k = -N:N;
W = 2*pi*k/((2*N+1)*dt);
F = dt * ft*exp(-j*t'*W);
plot(W,F), grid on;
xlabel('W'), ylabel('F(W)');
axis([-20*pi 20*pi -0.3 1.2]);
title('频谱图');
实验2 连续时间系统分析
一、实验目的
1 建立系统的概念;
2 掌握连续时间系统的单位冲激响应的求解;
3 掌握连续时间系统单位阶跃响应的求解;
4 掌握连续时间系统零极点的求解;
5 分析系统零极点对系统幅频特性的影响;
6 分析零极点对系统稳定性的影响;
7 介绍常用信号处理的MATLAB工具箱;
二、实战演练
1. 已知系统的微分方程为,计算该系统的单位冲激响应和单位阶跃响应。
单位冲激响应:
a=[1 3 2];
b=[1 4];
sys=tf(b,a);
t=0:0.1:10;
y=impulse(sys,t);
plot(t,y);
xlabel('time');
ylabel('h(t)');
单位阶跃响应:
a=[1 3 2];
b=[1 4];
sys=tf(b,a);
t=0:0.1:10;
y=step(sys,t);
plot(t,y);
xlabel('time');
ylabel('h(t)*u(t)');
2. 实现卷积,其中 。
解:
调试程序如下:
p=0.001;
nf=0:p:2;
f=2*((nf>=0)-(nf>=2));
nh=0:p:5;
h=exp(-nh);
t=min(nh)+min(nf):p:max(nh)+max(nf);
y=conv(f,h)*p;
subplot(311),stairs(nf,f);
title('f(t)');axis([0 3 0 2.1]);
subplot(3,1,2),stairs(nh,h);
title('h(t)');axis([0 3 0 1.1]);
subplot(3,1,3),plot(t,y);
title('y(t)=f(t)*h(t)');axis([0 5 0 2.1]);
3. 已知二阶系统方程,对下列情况分别求单位冲激响应,并画出其波形。
解:
a.
b.
c.
d.
调试代码如下:
a=[1,R/L,1/(L*C)];
b=[1/(L*C)];
sys=tf(b,a);
t=0:0.01:10;
y=impulse(sys,t);
plot(t,y);
xlabel('time');
ylabel('h(t)');
title('R=4,L=1,C=1/3');
axis([0 10 0 1]);
运行结果如下:
4. 求下列系统的零极点。
(1)
(2)
a=[1 2 -3 2 1];
b=[1 0 -4];
sys=tf(b,a);
pzmap(sys);
title('系统一');
a=[1 5 16 30];
b=[5 20 25 0];
sys=tf(b,a);
pzmap(sys);
title('系统二');
5. 对于更多零极点和不同零极点位置的连续系统,做出系统的零极点图;分析系统是否稳定?若稳定,做出系统的幅频特性曲线和相频特性曲线。
(1) 1个极点s=0,增益k=1;
(2) 2个共轭极点,增益k=1;
(3) 零点在s=0.5,极点在,增益k=1。
(1)
a=[1 0];
b=[1];
sys=tf(b,a);
pzmap(sys);
title('零极点图');
hold on;
bode(b,a);
(2)
a=[1 0 25];
b=[1];
sys=tf(b,a);
pzmap(sys);
title('零极点图');
bode(b,a);
(3)a=[1 0.2 25.01];
b=[1 -0.5];
sys=tf(b,a);
pzmap(sys);
title('零极点图');
bode(b,a);
实验3 信号抽样
一、 实验目的
1 运用MATLAB完成信号抽样及对抽样信号的频谱进行分析;
2 运用MATLAB改变抽样间隔,观察抽样后信号的频谱变化;
3 运用MATLAB对抽样后的信号进行重建。
二、 实战演练
1. 设有三个不同频率的正弦信号,频率分别为 。现在用抽样频率对这三个正弦信号进行抽样,用MATLAB命令画出各抽样信号的波形及频谱,并分析频率混叠现象。
解:
调试程序如下:
clc
clear
Ts = 1/3800;
dt = 0.000001;
t1 = -0.005:dt:0.005;
ft = sin(2*pi*100*t1);
subplot(221)
plot(t1,ft), grid on
xlabel('Time(sec)'),ylabel('f(t)')
title('f1信号')
N=500;
k = -N:N;
W = 2*pi*k/((2*N+1)*dt);
Fw = dt*ft*exp(-j*t1'*W);
subplot(222)
plot(W,abs(Fw)), grid on
xlabel('\omega'),ylabel('F(w)')
title('f1的频谱')
t2 = -0.005:Ts:0.005;
fst = sin(2*pi*100*t2);
subplot(223)
plot(t1,ft,':'),hold on
stem(t2,fst),grid on
xlabel('Time(sec)'),ylabel('fs(t)')
title('抽样后的信号'),hold off
Fsw = Ts*fst*exp(-j*t2'*W);
subplot(224)
plot(W,abs(Fsw)), grid on
xlabel('\omega'),ylabel('Fs(w)')
title('抽样信号的频谱')
运行结果如下:
(2)
调试程序如下:
clc
clear
Ts = 1/3800;
dt = 0.000001;
t1 = -0.005:dt:0.005;
ft = sin(2*pi*200*t1);
subplot(221)
plot(t1,ft), grid on
xlabel('Time(sec)'),ylabel('f(t)')
title('f2信号')
N=500;
k = -N:N;
W = 2*pi*k/((2*N+1)*dt);
Fw = dt*ft*exp(-j*t1'*W);
subplot(222)
plot(W,abs(Fw)), grid on
xlabel('\omega'),ylabel('F(w)')
title('f2的频谱')
t2 = -0.005:Ts:0.005;
fst = sin(2*pi*200*t2);
subplot(223)
plot(t1,ft,':'),hold on
stem(t2,fst),grid on
xlabel('Time(sec)'),ylabel('fs(t)')
title('抽样后的信号'),hold off
Fsw = Ts*fst*exp(-j*t2'*W);
subplot(224)
plot(W,abs(Fsw)), grid on
xlabel('\omega'),ylabel('Fs(w)')
title('抽样信号的频谱')
(3)
调试程序如下:
clc
clear
Ts = 1/3800;
dt = 0.00001;
t1 = -0.0005:dt:0.0005;
ft = sin(2*pi*3800*t1);
subplot(221)
plot(t1,ft), grid on
xlabel('Time(sec)'),ylabel('f(t)')
title('f3信号')
N=500;
k = -N:N;
W = 2*pi*k/((2*N+1)*dt);
Fw = dt*ft*exp(-j*t1'*W);
subplot(222)
plot(W,abs(Fw)), grid on
xlabel('\omega'),ylabel('F(w)')
title('f3的频谱')
t2 = -0.0005:Ts:0.0005;
fst = sin(2*pi*3800*t2);
subplot(223)
plot(t1,ft,':'),hold on
stem(t2,fst),grid on
xlabel('Time(sec)'),ylabel('fs(t)')
title('抽样后的信号'),hold off
Fsw = Ts*fst*exp(-j*t2'*W);
subplot(224)
plot(W,abs(Fsw)), grid on
xlabel('\omega'),ylabel('Fs(w)')
title('抽样信号的频谱')
运行结果如下:
2. 结合抽样定理,用MATLAB编程实现信号经冲激脉冲抽样后得到的抽样信号及其频谱,并利用重构信号。
调试程序如下:
clc
clear
wm =8;
wc = 1.2*wm;
Ts = 0.1;
n = -50:50;
nTs = n *Ts;
fs = sinc(nTs/pi);
t = -5:0.1:5;
ft = fs*Ts*wc/pi*sinc((wc/pi)*(ones(length(nTs),1)*t-nTs'*ones(1,length(t))));
t1 = -5:0.1:5;
f1 = sinc(t1/pi);
subplot(311)
plot(t1,f1,':'), hold on
stem(nTs,fs),grid on
xlabel('nTs'),ylabel('f(nTs)');
title('抽样间隔Ts=0.1时的抽样信号fs(t)')
hold off
subplot(312)
plot(t,ft),grid on
xlabel('t'),ylabel('f(t)');
title('由fs(t)信号重建得到Sa(t)信号')
error = abs(ft-f1);
subplot(313)
plot(t,error),grid on
xlabel('t'),ylabel('error(t)');
title('重建信号与原Sa(t)信号的绝对误差')
运行结果如下:
实验4 离散时间LTI系统分析
一、 实验目的
1 运用MATLAB求解离散时间系统的零状态响应;
2 运用MATLAB求解离散时间系统的单位冲激响应;
3 运用MATLAB求解离散时间系统的卷积和。
4 运用MATLAB求离散时间信号的z变换和z反变换;
5 运用MATLAB分析离散时间系统的系统函数的零极点;
6 运用MATLAB分析系统函数的零极点分布与其时域特性的关系;
7 运用MATLAB进行离散时间系统的频率特性分析。
二、实战演练
1. 试用MATLAB命令求解以下离散时间系统的单位冲激响应。
(1)
(2)
解:
调试程序如下:
(1)程序:
clc
clear
a=[3 4 1];
b=[1 1];
n=0:10
impz(b,a,10),grid on
title('系统单位冲激响应h(n)')
(2)程序:
clc
clear
a=[5/2 6 10];
b=[1];
n=0:30
impz(b,a,30),grid on
title('系统单位冲激响应h(n)')
2. 已知某系统的单位冲激响应为,试用MATLAB求当激励信号为时,系统的零状态响应。
程序:
clc
clear
nx=0:5;
nh=0:10;
x=(nx>=0)-(nx>=5);
h=(7/8).^nh.*((nh>=0)-(nh>=10));
y=conv(x,h);
subplot(311)
stem(nx,x,'fill'),grid on
xlabel('n'),title('x(n)')
subplot(312)
stem(nh,h,'fill'),grid on
xlabel('n'),title('h(n)')
subplot(313)
stem(y,'fill'),grid on
xlabel('n'),title('y(n)=x(n)*h(n)')
3. 试用MATLAB画出下列因果系统的系统函数零极点分布图,并判断系统的稳定性。
(1)
程序:
clc
clear
b=[-1.6,2,-0.9]
a=[1,-0.48,1.96,-2.5,]
zplane(b,a),grid on
legend('零点','极点')
title('零极点分布图')
该因果系统的极点不全部在单位圆内,故系统是不稳定的。
(2)
程序:
clc
clear
b=[1,-1]
a=[1,-0.9,-0.65,0.873,0]
zplane(b,a),grid on
legend('零点','极点')
title('零极点分布图')
该因果系统的极点全部在单位圆内,故系统是稳定的。
4. 试用MATLAB绘制系统的频率响应曲线。
程序:
clc
clear
b=[1 0 0];
a=[1 -3/4 1/8];
[H,w]=freqz(b,a,400,'whole');
Hm=abs(H);
Hp=angle(H);
subplot(211)
plot(w,Hm),grid on
xlabel('\omega(rad/s)'),ylabel('Megnitude')
title('离散系统幅频特性曲线')
subplot(212)
plot(w,Hp),grid on
xlabel('\omega(rad/s)'),ylabel('Phase')
title('离散系统相频特性曲线')
5. 自行设计系统函数,验证系统函数零极点分布与其时域特性的关系。
程序:
clc
clear
b=[1 0 ];
a=[1 -0.8 2];
subplot(221)
zplane(b,a)
title('极点在单位圆内的正实数')
subplot(222)
impz(b,a,30);grid on;
极点在单位圆外,h(n)为增幅序列。
实验5 语音信号的调制解调
一、实验目的
1. 了解语音信号处理在通信中的应用;
2. 理解幅度调制和解调的原理及方法;
3. 观察语音信号、载波信号、调制后信号和解调后信号的频谱。
二、实战演练
1. 载波为简单正弦信号的幅度调制和相干解调
调试程序:
clc
clear
ts=0.0001
t= -0.1:ts:0.1
mt=sin(2*pi*20*t)
A0=2
uc=sin(2*pi*800*t)
st=(A0+mt).*uc
subplot(311)
plot(t,mt)
title('sin signal')
subplot(312)
plot(t,uc)
title('carry')
subplot(313)
plot(t,st),grid on
title('AM')
%设计巴特沃兹滤波器
m0 = uc.*st
fs=20000
[N,Wn]=buttord(2*pi*200*2/fs,2*pi*400*2/fs,3,20,'s');
[B,A]=butter(N,Wn,'low');
figure(2)
m1=filtfilt(B,A,m0)
subplot(211)
plot(t,m0),grid on
title('通过乘法器')
subplot(212)
plot(t,m1),grid on
title('解调')
运行结果:
2. 载波为语音信号的幅度调制和相干解调
调试程序:
clear
clc
[x1,fs,bits]=wavread('part1.wav') ;
%x为数据点,fs为采样频率,bits为位数
%sound(x1,fs,bits)
%播放原是语音
y1=fft(x1,size(x1,1));
figure(1)
subplot(2,2,1)
%y1为x的频谱
f=fs*linspace(0,1,size(x1,1));
plot(x1)
title('原始语音信号')
subplot(2,2,2)
plot(f,abs(y1));
title('语音fft频谱图 ')
t=0:1/fs:(size(x1,1)-1)/fs;
%将所加噪声信号的点数调整到与原始信号相同
Au=0.3;
d=0.3*rand(1,367670)';
length(d)
%噪声为5khz的余弦
x2=x1+d;
sound(x2,fs,bits) ;
subplot(2,2,3)
y2=fft(x2,size(x1,1));
plot(t,x2)
title('加噪声语音时域图');
subplot(2,2,4)
plot(f,abs(y2))
title('加噪语音fft频域图');
%设计巴特沃兹滤波器
[N,Wn]=buttord(9000*2/fs,9800*2/fs,1,40,'s');
[B,A]=butter(N,Wn,'low');
figure(2)
freqz(B,A)
title('滤波器频谱图')
x3=filter(B,A,x2);
y3=fft(x3,size(x1,1));
figure(3)
subplot(2,1,1)
plot(t,x3)
title('滤波后的语音时域图')
subplot(2,1,2)
plot(f,abs(y3))
title('滤波后的语音fft频谱图')
运行结果:
实验6 Simulink模拟信号的调制解调
一、 实验目的
1. 理解幅度调制和解调的原理及方法;
2. 观察信号、载波信号、调制后信号和解调后信号的频谱;
3. 使用Simulink模拟信号的调制解调。
二、实战演练
Simulink模拟连接图
发射机:
(一)信号
(二)经过加法器后的信号
(三)经过乘法器后的信号
(四)噪声信号
(五)加上噪声信号后的信号
接收机:
(一)经过带通滤波器后的信号
(二)经过乘法器后的信号
(三)经过低通滤波器后的信号
实验体会
这门实验课让我在了解了语音信号调制和解调的基础上又用matlab模拟出来了波形。这就与广播电台发射广播信号的原理是一样的,让我体会到了信号与系统在实际生活中的重要作用。并且以前的信号都是已知的正弦信号,这次是第一次使用具有随机特点的语音信号。
最后一节课的内容与以往使用matlab语言编程有不同,这次是使用matlab里面的simulink模块来模拟信号的调制解调过程。信号调制解调的原理已经在实验五中有所了解,这次使用simulink模拟这个过程,将相应的模块安装在相应的位置上并不很难,难点是各个模块的参数的设置,特别是带通滤波器和低通滤波器,我一边查看视窗显示出来的波形,一边修改参数,直到得到理想的波形。
通过这个过程我明白了,只学习理论知识还是不够的,需要理论与实践相结合,使用simulink是个不错的选择,因为这里面的器件很全,模拟的过程很准确,能够准确的展现出实际情况。、
最后谢谢老师这一学期的悉心指导。
电英0901班
徐睿
200981519
展开阅读全文