ofdm中的ls算法LS algorithm in OFDM.docx

上传人:b****7 文档编号:10307080 上传时间:2023-02-10 格式:DOCX 页数:15 大小:17.56KB
下载 相关 举报
ofdm中的ls算法LS algorithm in OFDM.docx_第1页
第1页 / 共15页
ofdm中的ls算法LS algorithm in OFDM.docx_第2页
第2页 / 共15页
ofdm中的ls算法LS algorithm in OFDM.docx_第3页
第3页 / 共15页
ofdm中的ls算法LS algorithm in OFDM.docx_第4页
第4页 / 共15页
ofdm中的ls算法LS algorithm in OFDM.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

ofdm中的ls算法LS algorithm in OFDM.docx

《ofdm中的ls算法LS algorithm in OFDM.docx》由会员分享,可在线阅读,更多相关《ofdm中的ls算法LS algorithm in OFDM.docx(15页珍藏版)》请在冰豆网上搜索。

ofdm中的ls算法LS algorithm in OFDM.docx

ofdm中的ls算法LSalgorithminOFDM

ofdm中的ls算法(LSalgorithminOFDM)

基于梳状导频的ofdm信道估计

%ifft_bin_length:

和的点数IFFTFFT

carrier_count:

子载波个数%

bits_per_symbol:

每符号上的比特数%

%symbols_per_carrier:

每桢的OFDM符号数

X:

欲发送的二进制比特流%

清除所有;

中图分类号;

ifft_bin_length=128;%和的点数IFFTFFT

carrier_count=100;%%%子载波个数

bits_per_symbol=2;%每符号上的比特数

symbols_per_carrier=12;%每桢的OFDM符号数

李=7;%导频之间的间隔

NP=细胞(carrier_count/里县)+1;%%1导频数加的原因:

使最后一列也是导频

n_number=carrier_count**bits_per_symbolsymbols_per_carrier;

载体=1:

carrier_count+NP;

GI=8;%保护间隔长度

n_snr=25;%每比特信噪比

信噪比=5;%信噪比间隔

%symbols_per_carrier*(ifft_bin_length+GI)

%------------------------------------------------------------

%向量初始化

X=零(1,n_number);

[[]];

x2[[]];

X3=[];

X4=[];

X5=[];

X6=[];

X7=[];

Y1=[];

Y2=[];

Y3=[];

Y4=[];

Y5=[];

Y6=[];

Y7=[];

XX=零(1,n_number);

dif_bit=零(1,n_number);

dif_bit1=零(1,n_number);

dif_bit2=零(1,n_number);

dif_bit3=零(1,n_number);

randint(x=1,n_number);%产生二进制随即序列(非0即1)

%--------------------------------------------------------

%的QPSK调制:

(11)->π/4;(0,1)->3×π/4;(0,0)->3×π/4;(1,0)->-π/4;

S=(X×2-1)/sqrt

(2);

S=S(1:

2:

n_number);

图像=S(2:

2:

n_number);

X1=S+J*图像;

%---------------------------------------------------------

%产生随机导频信号

%--------------------------------------------------------

train_sym=randint(1,2symbols_per_carrier);

T=(train_sym。

*2-1)/sqrt

(2);

请=T(1:

2:

2*symbols_per_carrier);

图像=T(二时02分02秒*symbols_per_carrier);

training_symbols1=治疗+J*图像;

training_symbols2=training_symbols1。

”;

training_symbols=repmat(training_symbols2,1,NP);

%显示(training_symbols)

试验1:

李+1=carrier_count+NP;

如果长度(导频)=NP

飞行员=[试点,carrier_count+名词];

结束

%--------------------------------------------------------

%串并转换

X2=重塑(X1,carrier_count,symbols_per_carrier)。

”;

%---------------------------------------------------------

%插入导频

信号=1:

carrier_count+NP;

信号(导频)=[];

X3(:

,飞行员)=training_symbols;

X3(:

,信号)=x2;

%X3=猫(1,training_symbols,X2);

ifft_modulation=零(symbols_per_carrier,ifft_bin_length);

ifft_modulation(:

,携带者)=x3;

%ifft_modulation(:

,conjugate_carriers)=连词(X3);

X4=IFFT(ifft_modulation,ifft_bin_length,2);

%X5=X4.';

%plusprotectioninterval(cyclicprefix)

Fork=1:

symbols_per_carrier;

Fori=1:

IFFT_bin_length;

X6(k,i+GI)=X4(k,I);

End

Fori=1:

GI;

X6(k,I)=X4(k,i+IFFT_bin_length-GI);

End

End

%---------------------------------------------------------

%parallelstringconversion

X7=reshape(X6.',1,symbols_per_carrier*(IFFT_bin_length+GI));

%f=100;r=pi/6;

%forn=1:

length(X7)

%%a(n)=cos((2*pi*n)/8);

%a(n)=exp((i*((2*pi*f*n)/(8*length(X7))+r));

%%c=X7.*a(n);

%end

%b=real(X7.*a);

%

%m1=xcorr(b((?

),1:

136));

%m2=xcorr(b((?

),137:

272));

%a=zeros(1000271);

%fori=1:

1000

%b=xcorr(X7((?

),1:

136));

%c=xcorr(X7((?

),137:

272));

%a(I,:

)=b;

%end

%---------------------------------------------------------

%channelmodel:

RayleighfadingchannelwithDopplershift

Fd=100;%Dopplerfrequencyshift

R=6;%multipathnumber

A=[0.1230.30.40.50.70.8];%multipathamplitude

D=[2345913];%diameterdelay

T=1;%systemsamplingperiod

Th=[90072144216288]*pi./180;%phaseshift

H=ones(1,carrier_count);

Hh=[];

Fork=1:

r

%deta=[zeros(1,D(k)-1),1,zeros(1,carrier_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=[hh,h1];

End

H(d+1)=hh;

%noise=randn(1,length(X7))+j.*randn(1,length(X7));

%--------------------------------------------------------

Channel1=zeros(size(X7));

Channel1(1+d

(1):

length(X7))=hh

(1)*X7(1:

length(X7)-d

(1));

Channel2=zeros(size(X7));

Channel2(1+d

(2):

length(X7))=hh

(2)*X7(1:

length(X7)-d

(2));

Channel3=zeros(size(X7));

Channel3(1+d(3):

length(X7))=hh(3)*X7(1:

length(X7)-d(3));

Channel4=zeros(size(X7));

Channel4(1+d(4):

length(X7))=hh(4)*X7(1:

length(X7)-d(4));

Channel5=zeros(size(X7));

Channel5(1+d(5):

length(X7))=hh(5)*X7(1:

length(X7)-d(5));

Channel6=zeros(size(X7));

Channel6(1+d(6):

length(X7))=hh(6)*X7(1:

length(X7)-d(6));

%---------------------------------------------------------------

Tx_data=X7+channel1+channel2+channel3+channel4;

%---------------------------------------------------------------

%---------------------------------------------------------------

%----------------------------------------------------------------

%plusGausswhitenoise

Error_ber=[];%biterrorrate

Error_ber1=[];

Error_ber2=[];%biterrorrate

Error_ber3=[];

Error_ber11=[];

%Error_ser=[];%symbolerrorrate

Forsnr_db=0:

snr:

N_snr

%

%code_power=0;

%code_power=[norm(Tx_data)]^2/(length(Tx_data));

Symbolpowerofthe%signal

%%bit_power=var(Tx_data);

%bit_power=code_power/bits_per_symbol;%bitpower

%noise_power=10*log10((bit_power/(10^(snr_db/10))))%noisepower

%noise=wgn(1,length(Tx_data),noise_power,'complex');%producesGAUSSwhitenoisesignal

Vn=randn(1,symbols_per_carrier*(IFFT_bin_length+GI))+sqrt(-1)*randn(1,symbols_per_carrier*(IFFT_bin_length+GI));

Vn=vn/norm(VN)*10^(-snr_db/20)*norm(Tx_data);

Y7=Tx_data+vn;

%-------------------------------------------------------

%stringmergetransformation

Y6=reshape(Y7,IFFT_bin_length+GI,symbols_per_carrier);

Y6_1=reshape(Tx_data,IFFT_bin_length+GI,symbols_per_carrier);

%toprotectintervals

Fork=1:

symbols_per_carrier;

Fori=1:

IFFT_bin_length;

Y5(k,I)=Y6(k,i+GI);

Y5_1(k,I)=Y6_1(k,i+GI);

End

End

Y4=fft(Y5,IFFT_bin_length,2);

Y3=Y4((:

:

carriers));

Y4_1=fft(Y5_1,IFFT_bin_length,2);

Y3_1=Y4_1((:

:

carriers));

%-------------------------------------------------------------

%LSchannelestimation

H=[];

Y2=Y3((:

:

signal));

Y2_1=Y3_1((:

:

signal));

Rx_training_symbols=Y3((:

:

pilot));

Rx_training_symbols_1=Y3_1((:

:

pilot));

Rx_training_symbols0=reshape(Rx_training_symbols,symbols_per_carrier*Np,1);

Rx_training_symbols0_1=reshape(Rx_training_symbols_1,symbols_per_carrier*Np,1);

Training_symbol0=reshape(training_symbols,1,symbols_per_carrier*Np);

Training_symbol0_1=reshape(training_symbols,1,symbols_per_carrier*Np);

Training_symbol1=diag(training_symbol0);

Training_symbol1_1=diag(training_symbol0_1);

%disp(training_symbols)

Training_symbol2=inv(training_symbol1);

Hls=training_symbol2*Rx_training_symbols0;

Hls1=reshape(Hls,symbols_per_carrier,Np);

HLs=[];

HLs1=[];

Ifceil(carrier_count/LI)==carrier_count/LI

Fork=1:

Np-1

HLs2=[];

Fort=1:

LI

HLs1((=:

1)=(Hls1((?

),k+1)-Hls1((?

),K))*(t-1)./LI+Hls1((k));

HLs2=[HLs2,HLs1];

End

HLs=[HLs,HLs2];

End

Else

Fork=1:

Np-2

HLs2=[];

Fort=1:

LI

HLs1((=:

1)=(Hls1((?

),k+1)-Hls1((?

),K))*(t-1)./LI+Hls1((k));

HLs2=[HLs2,HLs1];

End

HLs=[HLs,HLs2];

End

HLs3=[];

Fort=1:

mod(carrier_count,LI)

HLs1((=:

1)=(Hls1((?

),Np)-Hls1((?

),Np-1))*(t-1)./LI+Hls1((Np-1));

HLs3=[HLs3,HLs1];

End;

HLs=[HLs,HLs3];

End

%Hls1=Hls.';

training_symbol2_1=inv(training_symbol1_1);

hls_1=training_symbol2_1*rx_training_symbols0_1;

hls1_1=重塑(hls_1,symbols_per_carrier,NP);

hls_1=[];

hls1_1=[];

如果细胞(carrier_count/李)==carrier_count/里县

K=1:

NP-1

hls2_1=[];

对于t=1:

hls1_1(:

,1)=(hls1_1(:

,K+1)-HLS1(:

,k))*(t-1)。

/李+HLS1(:

,k);

hls2_1=[hls2_1,hls1_1];

结束

hls_1=[hls_1,hls2_1];

结束

其他的

K=1:

NP-2

hls2_1=[];

对于t=1:

hls1_1(:

,1)=(hls1_1(:

,K+1)-hls1_1(:

,k))*(t-1)。

/锂离子hls1_1(:

,k);

hls2_1=[hls2_1,hls1_1];

结束

hls_1=[hls_1,hls2_1];

结束

hls3_1=[];

T=1:

MOD(carrier_count,李)

hls1_1(:

,1)=(hls1_1(:

,NP)-hls1_1(:

,NP-1))*(t-1)。

/锂离子hls1_1(:

,NP-1);

hls3_1=[hls3_1,hls1_1];

结束;

hls_1=[hls_1,hls3_1];

结束

%h=repmat(HLS1,symbols_per_carrier,1);%将导频扩展成symbols_per_carrier*carrier_count矩阵

Y1,Y2,HLS;

h_2=IFFT(HLS,100,2);

h_3=零(12100);

h_3(:

,1:

8)=h_2(:

,1:

8);

h_4=FFT(h_3100,2);

%h_2_1=IFFT(hls_1,ifft_bin_length,2);

Y11=Y2。

/h_4;

%Y11=Y2。

/

%-------------------------------------------------------------------

%-------------------------------------------------------------

%并串变换

YY=重塑(Y2。

',1,n_number/bits_per_symbol);

YY1=重塑(Y1。

',1,n_number/bits_per_symbol);

yy11=重塑(Y11。

',1,n_number/bits_per_symbol);

%------------------------------------------------------------

QPSK解调%

y_real=符号(房(YY));

y_image=符号(图像(YY));

y_re=y_real/sqrt

(2);

y_im=y_image/sqrt

(2);

y_real1=符号(房(YY1));

y_image1=符号(图像(YY1));

y_re1=y_real1/sqrt

(2);

y_im1=y_image1/sqrt

(2);

y_real11=符号(房(yy11));

y_image11=符号(图像(yy11));

y_re11=y_real11/sqrt

(2);

y_im11=y_image11/sqrt

(2);

r00=[];

R01=[];

R10=[];

R11=[];

R110=[];

R111=[];

K=1:

长度(y_real);

r00=[r00,[y_real(K),y_image(K)]];

结束;

K=1:

长度(y_real1);

R10=[R10,[y_real1(K),y_image1(K)]];

结束;

K=1:

长度(y_real11);

R110=[R10,[y_real11(K),y_image11(K)]];

结束;

K=1:

长度(y_re);

R01=[R01,[y_re(K),y_im(K)]];

结束;

K=1:

长度(y_re1);

R11=[R11,[y_re1(K),y_im1(K)]];

结束;

K=1:

长度(y_re11);

R111=[R111,

[y_re11(k),and_im1(k)]];

end;

%xx(find(r01>0)=1;

%-------------------------------------------------------------

%计算在不同信噪比下的误比特率并作图

the_bits=s-pl1.

the_date)=s-r11.

the_bit11=s-r111;

on_snr=0%纪录误比特数

fork=1:

n_number;

ifthe_bits(k)=0;

on_snr=on_snr+1;

end

end;

on_snr1=0%纪录误比特数

fork=1:

n_number;

ifthe_date)(k)=0;

on_snr1=on_snr1+1;

end

end

on_snr11=0%纪录误比特数

fork=1:

n_number;

ifthe_bit11(k)=0;

on_snr11=on_snr11+1;

end

end

error_ber=[error_).the_snr];

error_ber1=[error_ber1.the_snr1];

error_ber11=[error_ber11.the_snr11];

%margin=(sum(unit,1/12;

%mse=abs(margin(h)/((h);

end

on=zeros(1,length(0:

n_snrsnr));

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 判决书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1