• 大小: 2KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-12
  • 语言: Matlab
  • 标签: ACO-OF  

资源简介

1、首先,Matlab产生16QAM映射方式的OFDM符号,然后在产生ACO-OFDM信号。 2、在每个ACO-OFDM符号前添加循环前缀,然后编写ACO-OFDM信号发送接收程序。 3、信道使用高斯白噪声(AWGN)信道。 4、Matlab绘出时域ACO-OFDM信号,均衡后的接收信号的星座图。

资源截图

代码片段和文件信息

%E:\大学课件&科学浏览器\大三下\光纤通信\光纤实验\ACO OFDM
clc;
clear all ;
global N_IFFT;
global N_sc;
N_IFFT=64;%IFFT点数
N_sc=128;%有效数据的子载波数
BitperSymbol=4;%每符号的比特数
DataSymlength=256;%传输的符号数
% Data_Bitlength=DataSymlength*N_sc*BitperSymbol;
N_cp=16;%循环前缀的个数

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%产生数据信号(X_DataY_Data),round四舍五入取整
X_BitSource=round(rand(1DataSymlength*BitperSymbol*N_sc));  %131072

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%串并变换,每一行是一个子载波
X_input=reshape(X_BitSourceN_sc[]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%M-QAM调制  
%SymbolOrder = Binary时
%0  4  8  12
%1  5  9  13
%2  6  10 14
%3  7  11 15
hI = modem.qammod(‘M‘2^BitperSymbol ‘PhaseOffset‘ 0 ‘SymbolOrder‘‘Binary‘ ‘InputType‘ ‘bit‘);
X_Data = modulate(hIX_input);

figure(1);
plot(X_Data‘*r‘);title(‘16QAM调制后的X-Data‘);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%矩阵调整
X1_zero=X_Data;
X1_zero_half=X1_zero(1:N_sc/8:);   %X路数据的一半

%奇数子载波上数据置0
for k=1:N_sc/2^BitperSymbol
   X1_zero_half(2*k-11:DataSymlength*BitperSymbol)=zeros(1DataSymlength*BitperSymbol);
end    

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Hermitian对称关于第17行共轭对称
X1_zero_j=conj(X1_zero_half);   %求共轭

%初始化后半段信号
X1_zero_j_z=zeros(N_sc/8DataSymlength*BitperSymbol);

for i = 1:N_sc/16
    k=(N_sc/16+1)-i;
        X1_zero_j_z(2*i1:DataSymlength*BitperSymbol) = X1_zero_j(2*k1:DataSymlength*BitperSymbol);
end  

X1_zero = vertcat(X1_zero_halfX1_zero_j_z);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ifft变换,结果为实数
X1_ifft_output=ifft(X1_zero);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%零值处限幅,小于0的置0
X1_ifft_output_x=X1_ifft_output;
X1_ifft_output_x(find(X1_ifft_output<0))=0;

figure(2);
subplot(211);
stem(X1_ifft_output‘r.‘);title(‘限幅前X1‘);
subplot(212);
stem(X1_ifft_output_x‘r.‘);title(‘限幅后X1‘);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%加cp
%头部加cp
X1_cp=vertcat(X1_ifft_output_x(((end-N_cp+1):end):)X1_ifft_output_x);
figure(3);
subplot(211);
stem(X1_cp‘r‘);title(‘X1 with CP‘);
subplot(212);
stem(X1_ifft_output_x‘r‘);title(‘X1 without CP‘);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%并串变换
X1_OFDMSymbol=reshape(X1_cp.‘[]1).‘;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%高斯白噪声信道
RX1=awgn(X1_OFDMSymbol30);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%串并变换,加了16行的CP
RX1_para=reshape(RX1[]N_sc/4+N_cp).‘;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%去掉CP,去掉前16行,剩下的是数据
RX1_cutCP=RX1_para(N_cp+1:N_cp+N_sc/4 : );

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FFT运算
RX1_QAMSymbol=fft(RX1_cutCP);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%逆限幅
RX1_QAMSymbol_2=2*RX1_QAMSymbol;
RX1_QAMSymbol_2_z=RX1_QAMSymbol_2;
for i=1:16;
    RX1_QAMSymbol_2_z((2*i)-1:)=X_Data((2*i)-1:); %奇数位恢复
end
figure(4);
plot(RX1_QAMSymbol_2_z‘r.‘);title(‘FFT后RX1‘);
axis([-4 4 -4 4]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %解码
% DX1_Bit=zeros(N_scDataSymlength*BitperSymbol);

% for i=1:32
%     for j=1:1024
%         if real(RX1_QAMSymbol_2_z(ij)) > 2 && imag(RX1_QAMSymbol_2_z(ij)) > 2 %11

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4472  2018-06-05 15:07  ACO_OFDM.m

----------- ---------  ---------- -----  ----

                 4472                    1


评论

共有 条评论