资源描述
通信原理实验报告
实验一 数字基带传输系统的MATLAB仿真
实验二 模拟信号幅度调制仿真实验
姓 名:张 力
班 级:通信工程三班
学 号:2011551326
实验一 数字基带传输系统的MATLAB仿真
(1)分析程序 program1_1 每条指令的作用,运行该程序,将结果保存,贴在下面的空白处。然后修改程序,将 dt 改为 0.2,并执行修改后的程序,保存图形,看看所得图形的效果怎样。
程序如下:
dt = 0.01; % Specify the step of time variable
t = -2:dt:2; % Specify the interval of time
x = sin(2*pi*t); % Generate the signal
figure(1)
plot(t,x) % Open a figure window and draw the plot of x(t)
title('Sinusoidal signal x(t)')
xlabel('Time t (sec)')
text(1.5,0.8,'dt=0.01')
dt=0.01的时候
dt=0.2的时候
dt = 0.2; % Specify the step of time variable
t = -2:dt:2; % Specify the interval of time
x = sin(2*pi*t); % Generate the signal
figure(2)
plot(t,x) % Open a figure window and draw the plot of x(t)
title('Sinusoidal signal x(t)')
xlabel('Time t (sec)')
text(1.5,0.8,'dt=0.2')
请问:上述的两幅图形有什么区别,哪一副图形看起来更接近于实际信号波形?为什么会有这种区别?
答: 第一幅图看起来比较圆滑,与实际图形更加接近。
(2)修改program1_1,,存盘程序名为Q1_2,生成实指数信号x(t)=。要求在图形中加上网格线,并使用函数axis()控制图形的时间范围在0~2秒之间。然后执行该程序,保存所的图形。
修改Program1_1后得到的程序Q1_2如下:
clear, % Clear all variables
close all, % Close all figure windows
dt = 0.01; % Specify the step of time variable
t = -2:dt:2; % Specify the interval of time
x = exp(-2*t); % Generate the signal
plot(t,x) % Open a figure window and draw the plot of x(t)
grid on,
axis([0 2 0 1 ])
title('Sinusoidal signal x(t)')
xlabel('Time t (sec)')
图形结果如下:
(3)将前文中所给的单位冲激信号和单位阶跃信号的函数文件在 MATLAB 文件编辑器中编写好,并分别以文件名 delta和u 存入 work文件夹中以便于使用。
抄写函数文件 delta 如下: 抄写函数文件u 如下:
% delta function % Unit step function
function y = delta(t) function y = u(t)
dt = 0.01; y = (t>=0); % y = 1 for t > 0, else y = 0
y = (u(t)-u(t-dt))/dt;
(4) 修改程序Program1_4,并以Q1_4为文件名存盘,利用axis()函数,将图形窗口的横
坐标范围改为-2≤n≤5,纵坐标范围改为-1.5≤ x ≤1.5。
修改Program1_4后得到的程序Q1_4如下:
clear, % Clear all variables
close all, % Close all figure windows
n = -5:5; % Specify the interval of time
x = [zeros(1,4), 0.1, 1.1, -1.2, 0, 1.3, zeros(1,2)]; % Generate the sequence
stem(n,x,'filled','r') % Open a figure window and draw the plot of x[n]
axis([-2 6 -1.5 1.5])
grid on,
信号波形图如下:
修改过后的图形如下:
-2
-1
0
1
2
3
4
5
-1.5
-1
-0.5
0
0.5
1
1.5
(5)根据示例程序的编写方法,编写一个MATLAB程序,以Q1_5文件名存盘,给给定信号 x(t) = u(t) ,求信号y(t)=x(1.5t+3),并绘制出x(t)和y(t)的图形。
编写的程序 Q1_5 如下:
% Program1_5
% This program is used to implement the time-shift operation
% on a continuous-time signal and to obtain its time-shifted versions
% and to draw their plots.
clear,close all,
t = -5:0.01:5;
x =exp(-0.5*t).*u(t); % Generate the original signal x(t)
x1 =exp(-0.75*t+3).*u(1.5*t+3); % Shift x(t) to the left by 2 second to get x1(t)
subplot(311)
plot(t,x) % Plot x(t)
grid on,
subplot (312)
plot (t,x1) % Plot x1(t)
grid on,
-5
-4
-3
-2
-1
0
1
2
3
4
5
0
0.5
1
-5
-4
-3
-2
-1
0
1
2
3
4
5
0
50
100
实验二 模拟信号幅度调制仿真实验
(1)按照 3.1 所提供的 AM 调制的思路,运行提供的范例程序,存档为 Q2_1,并将所得的结果存盘,贴在下面空格处。
close all;
clear all;
dt=0.001;
fm=1;
fc=10;
T=5;
t=0:dt:T;
mt=sqrt(2)*cos(2*pi*fm*t);
A=2;
s_am=(A+mt).*cos(2*pi*fc*t);
B=2*fm;
figure(1)
subplot(211);
plot(t,s_am);
hold on;
plot(t,A+mt,'r--');
title('AM调制信号及其包络 魏金海');
xlabel('t');
原图形如下:
A=2时波形图如下:
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-4
-2
0
2
4
AM调制信号及其包络
t
(2)程序 1 中定义加入的直流分量为A0=2,请在A0的值分别改为 1 和 10,看得到的调制波形会有什么变化?
A0=1 的调制波形
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-4
-2
0
2
4
AM调制信号及其包络
t
A0=10 时的调制波形
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-20
-10
0
10
20
AM调制信号及其包络
t
请问,调制波形为什么会有这种变化,这种变化会造成什么影响?
答:因为AM信号调制的是幅度,当幅度较低时,是可以正常的。但一旦超过了最高范围时,就会发生失真。信号越强,那么位于信号中最高的输出时间就越长,这种情况就叫信号的阻塞。
(3)按照 3.2 所提供的DSB 调制的思路,运行提供的范例程序,存档为 Q2_2,并将所得的结果存盘,贴在下面空格处。
范例程序如下:
close all;
clear all;
dt=0.001;
fm=1;
fc=10;
T=5;
t=0:dt:T;
mt=sqrt(2)*cos(2*pi*fm*t);
s_dsb=mt.*cos(2*pi*fc*t);
B=2*fm;
figure(1);
subplot(211);
plot(t,s_dsb);
hold on;
plot(t,mt,'r--');
title('DSB调制信号');
xlabel('t');
DSB调制波形图如下:
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-2
-1
0
1
2
DSB调制信号
t
(4) 按照3.3所提供的相移法进行SSB调制的思路,运行提供的范例程序, 存档为Q2_3,并将所得的结果存盘,贴在下面空格处。
范例程序如下:
close all;
clear all;
dt=0.001;
fm=1;
fc=10;
T=5;
t=0:dt:T;
mt=sqrt(2).*cos(2*pi*fm*t);
%SSB modulation
A=2;
s_ssb=real(hilbert(mt).*exp(j*2*pi*fc*t));
%s_ssb=mt.*cos(2*pi*fc*t)/2+sqrt(2)*sin(2*pi*fm*t).*sin(2*pi*fc*t)/2;
B=fm;
figure(1);
plot(t,s_ssb);
hold on ;
plot(t,mt,'r--');
title('SSB调制信号及其包络');
xlabel('t');
axis([0 2 -1.5 1.5]);
SSB调制信号波形如下:
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
-1.5
-1
-0.5
0
0.5
1
1.5
t
(5)按照 3.3 所提供的滤波法进行 SSB 调制的思路,编写用滤波法实现 SSB 调制的程序,存档为 Q2_4,并将所得的结果存盘,贴在下面空格处。
(提示:使用 LPF 函数实现滤波)
LPF函数为:
function [t st]=lpf(f,sf,B)
df = f(2)-f(1);
T = 1/df;
hf = zeros(1,length(f));
bf = [-floor( B/df ): floor( B/df )] + floor( length(f)/2 );
hf(bf)=1;
yf=hf.*sf;
[t,st]=F2T(f,yf); //傅里叶逆变换函数
st = real(st); //取st的实部
此程序中调用的F2T函数程序如下:
function [t,st]=F2T(f,sf)
% This function calculate the time signal using ifft function for the input
% signal's spectrum
df=f(2)-f(1);
Fmx=(f(end)-f(1)+df);
dt=1/Fmx;
N=length(sf);
T=dt*N;
%t=-T/2:dt:T/2-dt;
t=0:dt:T-dt;
sff=fftshift(sf);
st=Fmx*ifft(sff);
主程序:
close all;
clear all;
dt=0.001;
fm=1;
fc=10;
T=5;
t=0:dt:T;
mt=sqrt(2)*cos(2*pi*fm*t);
s_dsb=mt.*cos(2*pi*fc*t); //产生DSB信号
B=2*fm;
figure(1);
subplot(311);
plot(t,s_dsb); //显示DSB信号波形在最上面的子图
hold on; //保持波形
plot(t,mt,'r--');
title('DSB调制信号');
xlabel('t');
f_dsb=fft(s_dsb); //DSB信号进行傅里叶变换,由时域转变到频域
temp=f_dsb;
temp([50:4953])=0; //将DSB频域信号低频区滤除
s_ssb=ifft(temp); //滤波后进行傅里叶逆变换,得到上边带信号
subplot(312);
plot(t,s_ssb);
hold on;
plot(t,mt,'r--');
title('SSB上边带');
xlabel('t');
temp=f_dsb;
temp([1:49])=0;
temp([4953:end])=0; //滤除高频区和低频区,得到带通的DSB频域信号
s_ssb=ifft(temp); //傅里叶逆变换得到SSB下边带信号
subplot(313);
plot(t,s_ssb);
hold on;
plot(t,mt,'r--');
title('SSB下边带');
xlabel('t');
实验结果:
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-2
0
2
DSB调制信号
t
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-2
0
2
SSB上边带
t
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
-2
0
2
SS下边带
t
(6)按照实验原理中介绍的功率谱的计算公式,在同一图形的四个子图中,分别画出基带信号、AM 调制信号、DSB 调制信号和 SSB 调制信号的功率谱,要求写出响应的程序,画出图形,并在图中标出相应的标题和坐标轴。
程序为:
close all; clear all;
dt=0.001;
fm=1;
fc=10;
T=5;
t=0:dt:T;
mt=sqrt(2)*cos(2*pi*fm*t);
A=2;
s_am=(A+mt).*cos(2*pi*fc*t);
s_dsb=mt.*cos(2*pi*fc*t);
s_ssb=real(hilbert(mt).*exp(j*2*pi*fc*t));
subplot(221)
[f,sf]=T2F(t,mt);
psf=(abs(sf).^2)/T;
plot(f,sf);
axis([-2*fc 2*fc 0 max(psf)]);
title('»ù´øÐźŹ¦ÂÊÆ×');
xlabel('f');
subplot(222)
[f,sf]=T2F(t,s_am);
[f1,sf1]=T2F(t,A+mt);
psf1=(abs(sf1).^2)/T;
psf=(abs(sf).^2)/T;
plot(f,psf,'r-');
hold on;
plot(f1,psf1);
axis([-2*fc 2*fc 0 max(psf)]);
title('AMÐźŹ¦ÂÊÆ×');
xlabel('f');
subplot(223)
[f,sf]=T2F(t,s_dsb);
psf=(abs(sf).^2)/T;
plot(f,sf);
axis([-2*fc 2*fc 0 max(psf)]);
title('DSBÐźŹ¦ÂÊÆ×');
xlabel('f');
subplot(224)
[f,sf]=T2F(t,s_ssb);
psf=(abs(sf).^2)/T;
plot(f,psf);
axis([-2*fc 2*fc 0 max(psf)]);
title('SSBÐźŹ¦ÂÊÆ×');
xlabel('f');
图形如下:
请分析四个子图中,基带信号、AM调制信号、DSB 调制信号和 SSB 调制信号的功率谱性质,对比其频域特性的区别,并分析为什么会有这些区别。
答: 时域:调制信号波形与AM的包络检波相同,而与DSB,SSB不同。
频域:AM信号包含有载波,上下边带。DSB仅有上下边带而无载波。上边带或下边带的宽度与调制信号带宽相同。
展开阅读全文