信道编码与扩频通信.docx

上传人:b****5 文档编号:14691281 上传时间:2023-06-26 格式:DOCX 页数:26 大小:250.37KB
下载 相关 举报
信道编码与扩频通信.docx_第1页
第1页 / 共26页
信道编码与扩频通信.docx_第2页
第2页 / 共26页
信道编码与扩频通信.docx_第3页
第3页 / 共26页
信道编码与扩频通信.docx_第4页
第4页 / 共26页
信道编码与扩频通信.docx_第5页
第5页 / 共26页
信道编码与扩频通信.docx_第6页
第6页 / 共26页
信道编码与扩频通信.docx_第7页
第7页 / 共26页
信道编码与扩频通信.docx_第8页
第8页 / 共26页
信道编码与扩频通信.docx_第9页
第9页 / 共26页
信道编码与扩频通信.docx_第10页
第10页 / 共26页
信道编码与扩频通信.docx_第11页
第11页 / 共26页
信道编码与扩频通信.docx_第12页
第12页 / 共26页
信道编码与扩频通信.docx_第13页
第13页 / 共26页
信道编码与扩频通信.docx_第14页
第14页 / 共26页
信道编码与扩频通信.docx_第15页
第15页 / 共26页
信道编码与扩频通信.docx_第16页
第16页 / 共26页
信道编码与扩频通信.docx_第17页
第17页 / 共26页
信道编码与扩频通信.docx_第18页
第18页 / 共26页
信道编码与扩频通信.docx_第19页
第19页 / 共26页
信道编码与扩频通信.docx_第20页
第20页 / 共26页
亲,该文档总共26页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

信道编码与扩频通信.docx

《信道编码与扩频通信.docx》由会员分享,可在线阅读,更多相关《信道编码与扩频通信.docx(26页珍藏版)》请在冰点文库上搜索。

信道编码与扩频通信.docx

信道编码与扩频通信

信道编码与扩频通信

直接扩频技术是二十一世纪通信的主要潮流之一。

特别是在移动通信领域,码分多址已经成为公认的二十一世纪蜂窝式移动通信基本特征。

故而通过仿真手段讨论扩频通信与信道编码的关系,具有相当重要的现实意义。

从某种意义上说,直接扩频技术也可以看作一种信道编码的分组编码形式,编译码都是通过码序列分组和同一个PN码的乘运算实现。

应用这一思想,可以进行二进制双极性扩频通信系统的蒙特卡罗仿真。

二进制双极性扩频通信系统的蒙特卡罗仿真

双用户二进制双极性扩频通信系统的蒙特卡罗仿真模型

 

输出数据1

±Er

nAsin(wn)

 

±Er

输出数据2

 

双用户二进制双极性扩频通信系统的蒙特卡罗仿真流程图

N

Y

为了简化二进制双极性扩频通信系统的蒙特卡罗仿真模型,使我们把主要精力真正集中于编码仿真本身,本次仿真用户数为2,PN码采用长度为30的gold码。

如上图所示,双用户二进制双极性扩频通信系统的蒙特卡罗仿真模型中还加入了正弦干扰序列发生器,以用来测试扩频技术对人为正弦干扰的抑制作用。

在双用户二进制双极性扩频通信系统的蒙特卡罗仿真流程图中,正弦干扰被视做噪声的一部分置于叠加噪声模块。

MATLAB源程序

function[p1,p2]=ss_Pe94_2105(snr_in_dB,A,w)

%ss_Pe94_2105.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真

%snr_in_dB信噪比

%p误码率

%A正弦干扰幅度

%w正弦干扰角频率

%PN码采用长度Lc为30的gold码,Lc=length(gold)=30

snr=10^(snr_in_dB/10);

sgma=1;

Eb=2*sgma^2*snr;

N=10^5;%仿真序列长度10^5,运行时间约3分钟

p1=0;

p2=0;

gold1=[0111000010000110010010111100000];

gold2=[0101101110001000001001000110001];

Lc=length(gold1);%Lc=30;

pn_seq1=2*gold1-1;

pn_seq2=2*gold2-1;

E_chip=Eb/Lc;

temp=0;

data1=0;

data2=0;

repeated_data1=zeros(1,Lc);

repeated_data2=zeros(1,Lc);

trans_sig1=zeros(1,Lc);

trans_sig2=zeros(1,Lc);

noise=zeros(1,Lc);

n=1:

Lc;

interference=zeros(1,Lc);

rec_sig=zeros(1,Lc);

temp1=zeros(1,Lc);

temp2=zeros(1,Lc);

decision_variable1=0;

decision_variable2=0;

decision1=0;

decision2=0;

num_of_err_1=0;

num_of_err_2=0;

time=0;

fori=1:

N

temp=rand;

if(temp<0.5)

data1=-1;

else

data1=1;

end

forj=1:

Lc

repeated_data1(j)=data1;

end

trans_sig1=sqrt(E_chip)*repeated_data1.*pn_seq1;

temp=rand;

if(temp<0.5)

data2=-1;

else

data2=1;

end

forj=1:

Lc

repeated_data2(j)=data2;

end

trans_sig2=sqrt(E_chip)*repeated_data2.*pn_seq2;

noise=sgma*randn(1,Lc);

time=time+1,

n=(time-1)*Lc+1:

time*Lc;

interference=A*sin(w*n);

rec_sig=trans_sig1+trans_sig2+noise+interference;

temp1=rec_sig.*pn_seq1;

decision_variable1=sum(temp1);

if(decision_variable1<0)

decision1=-1;

else

decision1=1;

end

if(decision1~=data1)

num_of_err_1=num_of_err_1+1;

end

temp2=rec_sig.*pn_seq2;

decision_variable2=sum(temp2);

if(decision_variable2<0)

decision2=-1;

else

decision2=1;

end

if(decision2~=data2)

num_of_err_2=num_of_err_2+1;

end

end

num_of_err_1,

num_of_err_2,

p1=num_of_err_1/N;

p2=num_of_err_2/N;

%ss_Pe94_2105.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真

echoon

%cd94_2_030_105.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真绘图

%PN码采用长度Lc为30的gold码,Lc=length(gold)=30

%仿真序列长度10^5,运行时间约1小时

A1=3;A2=7;A3=12;A4=0;%A1A2A3A4正弦干扰幅度

w0=1;%w0正弦干扰角频率

SNRindB=0:

2:

30;

fori=1:

length(SNRindB)

[smld_err_prb11(i),smld_err_prb12(i)]=ss_Pe94_2105(SNRindB(i),A1,w0);

[smld_err_prb21(i),smld_err_prb22(i)]=ss_Pe94_2105(SNRindB(i),A2,w0);

[smld_err_prb31(i),smld_err_prb32(i)]=ss_Pe94_2105(SNRindB(i),A3,w0);

[smld_err_prb41(i),smld_err_prb42(i)]=ss_Pe94_2105(SNRindB(i),A4,w0);

end;

%绘图函数

semilogy(SNRindB,smld_err_prb11,'mx-');

title('双用户二进制双极性扩频通信系统的蒙特卡罗仿真')

axis([0,30,10^(-5),1])

holdon

semilogy(SNRindB,smld_err_prb12,'mo-');

semilogy(SNRindB,smld_err_prb21,'gx-');

semilogy(SNRindB,smld_err_prb22,'go-');

semilogy(SNRindB,smld_err_prb31,'kx-');

semilogy(SNRindB,smld_err_prb32,'ko-');

semilogy(SNRindB,smld_err_prb41,'rx-');

semilogy(SNRindB,smld_err_prb42,'ro-');

%绘图函数

SNRindB2=0:

0.1:

30;

theo_err_prb=zeros(1,length(SNRindB2));

fori=1:

length(SNRindB2)

SNR=exp(SNRindB2(i)*log(10)/10);

theo_err_prb(i)=Qfunct(sqrt(2*SNR));

%Qfuncty=(1/2)*erfc(x/sqrt

(2));理论误码率公式

end

semilogy(SNRindB2,theo_err_prb,'b:

');%绘图函数

%cd94_2_030_105.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真绘图

运行结果

下图(cd94_2_030_105的运行结果)给出了不同信噪比条件(0dB-30dB)和不同幅度(A1=3、A2=7、A3=12、A4=0)正弦干扰下,发送100000比特的双用户二进制双极性扩频通信系统的蒙特卡罗仿真结果以及理论值曲线。

从仿真结果来看,无正弦干扰下的蒙特卡罗仿真结果与理论值曲线吻合程度好的令人惊叹,仿真中两用户在同一信道真正实现了和平共处,因此用蒙特卡罗仿真模型来模拟实际双用户二进制双极性扩频通信系统,是可以被接受的;同时可以看出,扩频技术对人为的正弦干扰具有抑制能力,并且对于同样的人为正弦干扰,不同gold码的抑制干扰能力相对来说也有高下之分,在本次仿真中,用户1使用的gold码抑制正弦干扰能力更强。

级联码对双用户二进制双极性扩频系统误码性能的改善

无正弦干扰下的仿真结果和扩频理论都已经说明,从单个用户角度来看,双用户二进制双极性扩频通信系统和原来的单用户二进制双极性通信系统是相同的。

于是我们可以推论,在双用户二进制双极性扩频通信系统中对上文各种信道编码性能测试结果,也将和前面的测试结果相同,即按照误码率性能指标,信道编码的最好方案是级联码。

另外,考虑到实际应用信道编码时通常采用级联码,本次双用户二进制双极性扩频通信系统中的信道编码仿真采用了级联码。

在双用户二进制双极性扩频通信系统的蒙特卡罗仿真模型框图中加入级联码的编译码器,就构成了测试级联码对双用户二进制双极性扩频通信系统误码性能改善的蒙特卡罗仿真模型,系统框图如下:

双用户二进制双极性扩频级联码通信系统的蒙特卡罗仿真模型

 

数据1

±Er

nAsin(wn)

 

±Er

数据2

 

双用户二进制双极性扩频级联码通信系统的蒙特卡罗仿真流程图

N

Y

MATLAB源程序

function[p1,p2]=ss_Pe94_2(snr_in_dB,A,w)

%ss_Pe94_2.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真函数

%snr_in_dB信噪比

%p误码率

%A正弦干扰幅度

%w正弦干扰角频率

%PN码采用长度Lc为30的gold码,Lc=length(gold)=30

snr=10^(snr_in_dB/10);

sgma=1;

Eb=2*sgma^2*snr;

N=16;%N

loop=10^4;%loop

Ns=N*loop1*loop2;%仿真序列长度loop*N=16*10^4,运行时间约5分钟

p1=0;

p2=0;

gold1=[0111000010000110010010111100000];

gold2=[0101101110001000001001000110001];

Lc=length(gold1);%Lc=30;

pn_seq1=2*gold1-1;

pn_seq2=2*gold2-1;

E_chip=Eb/Lc;

temp=0;

data1=0;

data2=0;

repeated_data1=zeros(1,Lc);

repeated_data2=zeros(1,Lc);

trans_sig1=zeros(1,Lc);

trans_sig2=zeros(1,Lc);

noise=zeros(1,Lc);

n=1:

Lc;

interference=zeros(1,Lc);

rec_sig=zeros(1,Lc);

temp1=zeros(1,Lc);

temp2=zeros(1,Lc);

decision_variable1=0;

decision_variable2=0;

decision1=0;

decision2=0;

num_of_err_1=0;

num_of_err_2=0;

time=0;

forh=1:

loop

fori=1:

N

temp=rand;

if(temp<0.5)

data1=-1;

else

data1=1;

end

forj=1:

Lc

repeated_data1(j)=data1;

end

trans_sig1=sqrt(E_chip)*repeated_data1.*pn_seq1;

temp=rand;

if(temp<0.5)

data2=-1;

else

data2=1;

end

forj=1:

Lc

repeated_data2(j)=data2;

end

trans_sig2=sqrt(E_chip)*repeated_data2.*pn_seq2;

noise=sgma*randn(1,Lc);

time=time+1,

n=(time-1)*Lc+1:

time*Lc;

interference=A*sin(w*n);

rec_sig=trans_sig1+trans_sig2+noise+interference;

temp1=rec_sig.*pn_seq1;

decision_variable1=sum(temp1);

if(decision_variable1<0)

decision1=-1;

else

decision1=1;

end

if(decision1~=data1)

num_of_err_1=num_of_err_1+1;

end

temp2=rec_sig.*pn_seq2;

decision_variable2=sum(temp2);

if(decision_variable2<0)

decision2=-1;

else

decision2=1;

end

if(decision2~=data2)

num_of_err_2=num_of_err_2+1;

end

end

end

num_of_err_1,

num_of_err_2,

p1=num_of_err_1/Ns;

p2=num_of_err_2/Ns;

%ss_Pe94_2.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真函数

function[p1,p2]=ss_Pe94_2_cnv_jz_74(snr_in_dB,A,w)

%ss_Pe94_2_cnv_jz_74.m双用户二进制双极性扩频通信系统的蒙特卡罗仿真函数

%snr_in_dB信噪比

%p误码率

%A正弦干扰幅度

%w正弦干扰角频率

%PN码采用长度Lc为30的gold码,Lc=length(gold)=30

snr=10^(snr_in_dB/10);

sgma=1;

Eb=2*sgma^2*snr;

N=16;%N

loop=10^4;%loop

Ns=N*loop;%仿真序列长度Ns=loop*N=16*10^4,运行时间约15分钟dsource1=zeros(1,N);

dsource2=zeros(1,N);

output1_h74=hamming74(dsource1);

output2_h74=hamming74(dsource2);

G=[1011;1111];

k=1;

output_cnv_encd1=cnv_encd(G,k,output1_h74);

output_cnv_encd2=cnv_encd(G,k,output2_h74);

channel_output1=zeros(1,length(output_cnv_encd2));

channel_output2=zeros(1,length(output_cnv_encd2));

[decoder_output1,survivor_state1,cumulated_metric1]=viterbi(G,k,channel_output1);

[decoder_output2,survivor_state2,cumulated_metric2]=viterbi(G,k,channel_output2);

[h4output1,h7output1]=h47(decoder_output1);

[h4output2,h7output2]=h47(decoder_output2);

p1=0;

p2=0;

numoferr1=0;

numoferr2=0;

num_of_err_1=0;

num_of_err_2=0;

cnv_jz_74_time=0;

gold1=[0111000010000110010010111100000];

gold2=[0101101110001000001001000110001];

Lc=length(gold1);%Lc=30;

pn_seq1=2*gold1-1;

pn_seq2=2*gold2-1;

E_chip=Eb/Lc;

temp=0;

data1=0;

data2=0;

repeated_data1=zeros(1,Lc);

repeated_data2=zeros(1,Lc);

trans_sig1=zeros(1,Lc);

trans_sig2=zeros(1,Lc);

noise=zeros(1,Lc);

n=1:

Lc;

interference=zeros(1,Lc);

rec_sig=zeros(1,Lc);

temp1=zeros(1,Lc);

temp2=zeros(1,Lc);

decision_variable1=0;

decision_variable2=0;

decision1=0;

decision2=0;

forh=1:

loop

fori=1:

N

temp=rand;

if(temp<0.5)

dsource1(i)=0;

else

dsource1(i)=1;

end

temp=rand;

if(temp<0.5)

dsource2(i)=0;

else

dsource2(i)=1;

end

end

%length(dsource)28

output1_h74=hamming74(dsource1);

output2_h74=hamming74(dsource2);

output1_jz28=jiaozhi(output1_h74,28);

output2_jz28=jiaozhi(output2_h74,28);

output_cnv_encd1=cnv_encd(G,k,output1_jz28);

output_cnv_encd2=cnv_encd(G,k,output2_jz28);

%length(output_cnv_encd),pause

form=1:

length(output_cnv_encd1)%=length(output_cnv_encd2)

data1=2*output_cnv_encd1(m)-1;

data2=2*output_cnv_encd2(m)-1;

forj=1:

Lc

repeated_data1(j)=data1;

repeated_data2(j)=data2;

end

trans_sig1=sqrt(E_chip)*repeated_data1.*pn_seq1;

trans_sig2=sqrt(E_chip)*repeated_data2.*pn_seq2;

noise=sgma*randn(1,Lc);

cnv_jz_74_time=cnv_jz_74_time+1;

n=(cnv_jz_74_time-1)*Lc+1:

cnv_jz_74_time*Lc;

interference=A*sin(w*n);

rec_sig=trans_sig1+trans_sig2+noise+interference;

%

temp1=rec_sig.*pn_seq1;

decision_variable1=sum(temp1);

if(decision_variable1<0)

decision1=-1;

else

decision1=1;

end

if(decision1~=data1)

num_of_err_1=num_of_err_1+1;

end

%

temp2=rec_sig.*pn_seq2;

decision_variable2=sum(temp2);

if(decision_variable2<0)

decision2=-1;

else

decision2=1;

end

if(decision2~=data2)

num_of_err_2=num_of_err_2+1;

end

%

channel_output1(m)=(decision1+1)/2;

channel_output2(m)=(decision2+1)/2;

%

end

[decoder_output1,survivor_state1,cumulated_metric1]=viterbi(G,k,channel_output1);

[decoder_output2,survivor_state2,cumulated_metric2]=viterbi(G,k,channel_output2);

[decoder_output1_jjz28]=jiejiaozhi(decoder_output1,28);

[decoder_output2_jjz28]=jiejiaozhi(decoder_output2,28);

[h4output1,h7output1]=h47(decoder_output1_jjz28);

[h4output2,h7output2]=h47(decoder_output2_jjz28);

fori=1:

N%=length(dsource1)=length(dsource2)

if(h4output1(i)~=dsource1(i))

numoferr1=numoferr1+1;

end

if(h4output2(i)~=dsource2(i))

numoferr2=numoferr2+1;

end

end

end

num_of_err_1,

numoferr1,

num_of_err_1-numoferr1,

num_of_err_2,

numoferr2,

num_of_err_2-

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

当前位置:首页 > 小学教育 > 其它课程

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2