通信系统课程设计基于MATLAB数字基带传输系统及数字调..doc
文本预览下载声明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
%加入不同强度的高斯白噪声 y_output=qamdet(y_add_noise,fs,fb,fc; %傅里叶变
换,求出解调信号的频谱 n1=length(y_output; Fy_output=fft(y_output/n1;
Fy_output=abs(Fy_output(1:fix(n1/2*2; q=find(Fy_output1e-04; Fy_output(q=1e-04;
Fy_output=20*log10(Fy_output; f1=m/n1; f2=0:f1:(length(Fy_output-1*f1; numoferr=0;
for i=1:N if (y_output(i~=info(i, numoferr=numoferr+1; end; end; Pe(j=numoferr/N; end;
figure; subplot(311; plot(y_add_noise; title(已调信号加噪后输出 ; subplot(312;
plot(y_output; title( 解调输出信号 ; %对已调信号进行解调 %统计误码率 46
subplot(313; plot(Fy_output; title(解调信号频谱
%%%%%%%%%%%%%%%%%%%%random_binary.m %%%%%%%%%%%%%
%%%产生二进制信源随机序列 function [info]=random_binary(N if nargin == 0, % 如
果没有输入参数,则指定信息序列为 10000 个码元 N=10000; end; for i=1:N,
temp=rand; if (temp0.5, info(i=0; % 1/2 的概率输出为 0 else info(i=1; % 1/2 的概率
输出为 1 end end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%qam.m function [y,I,Q]=qam(x,Kbase,fs,fb,fc; T=length(x/fb; m=fs/fb; nn=length(x; dt=1/fs; t=0:dt:T-dt; y=yn; ymin=min(y; ymax=max(y; ymax=max([ymax abs(ymin]; ymin=-abs(ymax; yn=(y-ymin*3/(ymax-ymin; % 设置门限电平,判决 I0=find(yn 0.5; yn(I0=zeros(size(I0; I1=find(yn=0.5 yn1.5; yn(I1=ones(size(I1; I2=find(yn=1.5 yn2.5; yn(I2=ones(size(I2*2; I3=find(yn=2.5; yn(I3=ones(size(I3*3; % 一位四进制码元变换为两位二进制码元 T=[0 0;0 1;1 1;1 0]; n=length(yn; for i=1:n; xn(i,:=T(yn(i+1,:; end; xn=xn; xn=xn(:; xn=xn; constel.m %画出星座图 function c=constel(x,fs,fb,fc; N=length(x; m=2*fs/fb; n=fs/fc; i1=m-n; i=1; ph0=(i1-1*2*pi/n; while i = N/m; xi=x(i1:i1+n-1; y=2*fft(xi/n; c(i=y(2; i=i+1; i1=i1+m; 47
end; %如果无输出,则作图 if nargout1; cmax=max(abs(c; ph=(0:5:360*pi/180; plot(1.414*cos(ph,1.414*sin(ph,c; hold on; for i=1:length(c; ph=ph0-angle(c(i; a=abs(c(i/cmax*1.414; plot(a*cos(ph,a*sin(ph,r*; end; plot([-1.5 1.5],[0 0],k:,[0 0],[-1.5 1.5],k:; hold off; axis equal; axis([-1.5 1.5 -1.5 1.5]; end; 仿真结果 2: 2.6 心得
1.通过本次课程设计,我认识了有关二进制数字调制( 2FSK)的设计原理及 方
法,进一步认识了些 Matlab 库函数,如: ran
显示全部