多径信道 数字 matlab,OFDM信道建模如何修改多径参数

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

图片上传不了,不知道是不是这个程序,有没有大佬帮忙看一下对不对,修改第二个程序能不能改多径参数,第一个俄程序怎么才能运行,貌似缺参数

[code]r=3;%多径数

a=[0.1 0.2 0.3];%多径的幅度

d=[5 10 15];%各径的延迟

rx1=rx_signal.';

channel1=zeros(length(rx1),1);

channel1(1+d(1):end)=a(1)*rx1(1:end-d(1));

channel2=zeros(length(rx1),1);

channel2(1+d(2):end)=a(2)*rx1(1:end-d(2));

channel3=zeros(length(rx1),1);

channel3(1+d(3):end)=a(3)*rx1(1:end-d(3));

rx2=rx1+channel1+channel2+channel3;

rx_signal =rx2.';[/code]

[code]

clear all;

close all;

clc;

%%%%%%%%%%%%%%%%%%%%%%%%parameter settings%%%%%%%%%%%%%%%%%%%%%%%%%%

M=64;

NSubc=64; %Number of subcarriers

NFFT=256; %Length of IFFT

CpLength=32; %Length of Circle Prefix

TolPac=100;

PacketLen=10; %每块的符号数目,在每块前加入导频。

Numsymbol=PacketLen*TolPac+TolPac;%总的符号数(包括导频符号在内)

%信道参数

Ts=1; %进入信道信号的采样时间(归一化)

TauRay=[0,5,12];

PdbRay=[0,-5,-8];

Ch = rayleighchan(Ts,0,[0 5 12]*Ts,[0 -5 -8]);

%信噪比

EbNo=0:1:20;

SNR=EbNo+10*log10(sqrt(M))-10*log10(NFFT/NSubc);

%%%%%%%%%%%%%%%%%%%%%%%%%生成信息序列%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

BitsNum=PacketLen*TolPac*NSubc*log2(M);

Bit=randint(1,PacketLen*TolPac*NSubc*log2(M));

BitTemp=reshape(Bit,PacketLen*TolPac*NSubc,log2(M));

BitDe=bi2de(BitTemp,'left-m**'); %binary to decimal

SymbolMod=qammod(BitDe,M); %64QAM modulation

SymbolS2P=reshape(SymbolMod,NSubc,PacketLen*TolPac);

Symbol_In_Zero=[SymbolS2P(1:NSubc/2,:);zeros((NFFT-NSubc),PacketLen*TolPac);SymbolS2P(NSubc/2+1:end,:)];%添零

SymbolIFFT=ifft(Symbol_In_Zero);

%%%%%%%%%%%%%Frame Generatration%%%%%%%%%%%%%%%

%加入循环前缀

SymbolCP=[SymbolIFFT(end-CpLength+1:end,:);SymbolIFFT];

[nr,nl]=size(SymbolCP);

SymbolTS2P=reshape(SymbolCP,1,nr*nl);

%%

%%%%%%%%%%%%channel%%%%%%%%%%%%%%%;

for ksnr=1:length(SNR)

DataCh=filter(Ch,SymbolTS2P);

Ch.ResetBeforeFiltering = 0;

DataNoise=awgn(DataCh,SNR(ksnr),'measured');

DataRePN=DataNoise;

DataRS2P=reshape(DataRePN,nr,nl);

DataReCp=DataRS2P(CpLength+1:end,:);

DataFFT=fft(DataReCp);

DataReZero=[DataFFT(1:NSubc/2,:);DataFFT(end-NSubc/2+1:end,:)];

DataDemod=qamdemod(DataReZero,M);

DataTP2S=reshape(DataDemod,NSubc*PacketLen*TolPac,1);

DataBI=de2bi(DataTP2S,'left-m**');

REBIT=reshape(DataBI,1,NSubc*PacketLen*TolPac*log2(M));

[WNUM(ksnr),WBER(ksnr)]=biterr(REBIT,Bit);

end

%生成导频随机序列

LmSeeds=[0 1 1 1 0 0 0 1];

LTraining=m_sequence(LmSeeds);

for k=1:length(LTraining)

if LTraining(k)==0;

LTraining(k)=-1;

end

end

LTrain=6.48*[LTraining(1:(length(LTraining)+1)/2),-1,LTraining((length(LTraining)+1)/2+1:end)];

%6.48 is the average power of 64QAM

%%%%%%%%%%%%%%%%%%%%%%%%%生成信息序列%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

BitsNum=PacketLen*TolPac*NSubc*log2(M);

Bit=randint(1,PacketLen*TolPac*NSubc*log2(M));

BitTemp=reshape(Bit,PacketLen*TolPac*NSubc,log2(M));

BitDe=bi2de(BitTemp,'left-m**'); %binary to decimal

SymbolMod=qammod(BitDe,M); %64QAM modulation

SymbolS2P=reshape(SymbolMod,NSubc,PacketLen*TolPac);

Symbol_In_Zero=[SymbolS2P(1:NSubc/2,:);zeros((NFFT-NSubc),PacketLen*TolPac);SymbolS2P(NSubc/2+1:end,:)];%添零

SymbolIFFT=ifft(Symbol_In_Zero);

%%%%%%%%%%%%%Frame Generatration%%%%%%%%%%%%%%%

pilot=ifft(LTrain).';%时域的导频

pilotTb=[pilot(end-CpLength+1:end);pilot];

SymbolPilot=zeros(NFFT,PacketLen*TolPac+TolPac);

%加入导频

for k=1:TolPac;

SymbolPilot(:,(k-1)*PacketLen+k:(PacketLen+1)*k)=[pilot,SymbolIFFT(:,(k-1)*PacketLen+1:k*PacketLen)];

end

%加入循环前缀

SymbolCP=[SymbolPilot(end-CpLength+1:end,:);SymbolPilot];

[nr,nl]=size(SymbolCP);

SymbolTS2P=reshape(SymbolCP,1,nr*nl);

%%

%%%%%%%%%%%%channel%%%%%%%%%%%%%%%;

for ksnr=1:length(SNR)

DataCh=filter(Ch,SymbolTS2P);

Ch.ResetBeforeFiltering = 0;

DataNo=awgn(DataCh,SNR(ksnr),'measured');

DataRS2P=reshape(DataNo,nr,nl);

DataReCp=DataRS2P(CpLength+1:end,:);

DataFFT=fft(DataReCp);

%%信道估计

pilot_inter=PacketLen;

pilot_sequence=LTrain.';

pilot_num=TolPac;

DataLmmse=lmmse_estimation(DataFFT,pilot_inter,pilot_num,pilot_sequence,CpLength);%%%LMMSE信道估计

DataReZero=[DataLmmse(1:NSubc/2,:);DataLmmse(end-NSubc/2+1:end,:)];

DataDemod=qamdemod(DataReZero,M);

DataTP2S=reshape(DataDemod,NSubc*PacketLen*TolPac,1);

DataBI=de2bi(DataTP2S,'left-m**');

REBIT=reshape(DataBI,1,NSubc*PacketLen*TolPac*log2(M));

[WNUM(ksnr),WBER(ksnr)]=biterr(REBIT,Bit);

end

semilogy(EbNo,WBER,'g-v');

xlabel('信噪比(dB)');

ylabel('误码率');

title('多径衰落信道误码性能曲线');

grid on;

[/code]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值