资源简介
用于OFDMA仿真用程序包,用matlab编写
代码片段和文件信息
%function a1
%author:liuqingwei May 12th 2006 9:40 PM.
%OFDM Channel Estimation based on Comb Pilot
%IFFT_bin_length: IFFT和FFT的点数
%carrier_count: 子载波个数
%bits_per_symbol: 每符号上的比特数
%symbols_per_carrier: 每桢的OFDM符号数
%X:欲发送的二进制比特流
clear all;
clc;
IFFT_bin_length=512;
carrier_count=270;
bits_per_symbol=2;
symbols_per_carrier=12;
LI=7 ; %导频之间的间隔
Np=ceil(carrier_count/LI)+1;%导频数 %加1的原因:使最后一列也是导频
N_number=carrier_count*symbols_per_carrier*bits_per_symbol;
carriers=1:carrier_count+Np;
GI=8; % guard interval length
N_snr=20; % 每比特信噪比
snr=8; %信噪比间隔
%------------------------------------------------------------
% vector initialization
X=zeros(1N_number);
X1=[];
X2=[];
X3=[];
X4=[];
X5=[];
X6=[];
X7=[];
Y1=[];
Y2=[];
Y3=[];
Y4=[];
Y5=[];
Y6=[];
Y7=[];
XX=zeros(1N_number);
dif_bit=zeros(1N_number);
dif_bit1=zeros(1N_number);
dif_bit2=zeros(1N_number);
dif_bit3=zeros(1N_number);
X=randint(1N_number);%产生二进制随即序列(非0即1)
%--------------------------------------------------------
%QPSK调制:(1 1)->pi/4;(0 1)->3*pi/4;(0 0)->-3*pi/4;(10)->-pi/4;
s=(X.*2-1)/sqrt(2);
sreal=s(1:2:N_number);
simage=s(2:2:N_number);
X1=sreal+j.*simage;
%---------------------------------------------------------
%产生随机导频信号
%--------------------------------------------------------
train_sym=randint(12*symbols_per_carrier);
t=(train_sym.*2-1)/sqrt(2);
treal=t(1:2:2*symbols_per_carrier);
timage=t(2:2:2*symbols_per_carrier);
training_symbols1=treal+j.*timage;
training_symbols2=training_symbols1.‘;
training_symbols=repmat(training_symbols21Np);
%disp(training_symbols)
pilot=1:LI+1:carrier_count+Np;
if length(pilot)~=Np
pilot=[pilotcarrier_count+Np];
end
%--------------------------------------------------------
%串并转换
X2=reshape(X1carrier_countsymbols_per_carrier).‘;
%---------------------------------------------------------
%插入导频
signal=1:carrier_count+Np;
signal(pilot)=[];
X3(:pilot)=training_symbols;
X3(:signal)=X2;
%X3=cat(1training_symbolsX2);
IFFT_modulation=zeros(symbols_per_carrierIFFT_bin_length);
IFFT_modulation(:carriers)=X3;
%IFFT_modulation(:conjugate_carriers)=conj(X3);
X4=ifft(IFFT_modulationIFFT_bin_length2);
%X5=X4.‘;
%加保护间隔(循环前缀)
for k=1:symbols_per_carrier;
for i=1:IFFT_bin_length;
X6(ki+GI)=X4(ki);
end
for i=1:GI;
X6(ki)=X4(ki+IFFT_bin_length-GI);
end
end
%---------------------------------------------------------
%并串转换
X7=reshape(X6.‘1symbols_per_carrier*(IFFT_bin_length+GI));
%---------------------------------------------------------
%信道模型:带多普勒频移的瑞利衰落信道
fd=100; %多普勒频移
r=6; %多径数
a=[0.123 0.3 0.4 0.5 0.7 0.8]; %多径的幅度
d=[2 3 4 5 9 13]; %各径的延迟
T=1; %系统采样周期
th=[90 0 72 144 216 288]*pi./180;%相移
h=zeros(1carrier_count);
hh=[];
for k=1:r
%deta=[zeros(1d(k)-1)1zeros(1carrier_count-d(k))];
h1=a(k)*exp(j*((2*pi*T*fd*d(k)/carrier_count)));
%h1=a(k)*exp(j*((2*pi*T*fd*d(k)/carrier_count)));
hh=[hhh1];
end
h(d+1)=hh;
%noise=randn(1length(X7))+j
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7897 2007-04-29 09:57 OFDM\a1.m
文件 1668 2006-05-15 11:10 OFDM\OFDM_BPSK_BER\BPSKmodanddemod.m
文件 1833 2006-05-15 11:10 OFDM\OFDM_BPSK_BER\increaseber.m
文件 4707 2006-05-15 11:10 OFDM\OFDM_BPSK_BER\ofdm_ber.m
..AD... 0 2007-04-26 14:52 OFDM\OFDM_BPSK_BER
目录 0 2007-04-28 11:27 OFDM
----------- --------- ---------- ----- ----
16323 7
评论
共有 条评论