cdma的MATLAB仿真源程序_第1页
cdma的MATLAB仿真源程序_第2页
cdma的MATLAB仿真源程序_第3页
cdma的MATLAB仿真源程序_第4页
cdma的MATLAB仿真源程序_第5页
已阅读5页,还剩32页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

cdma的MATLAB仿真源程序cdma的MATLAB仿真源程序cdma的MATLAB仿真源程序xxx公司cdma的MATLAB仿真源程序文件编号:文件日期:修订次数:第1.0次更改批准审核制定方案设计,管理制度%*************************************************************************************%ThisfunctionpertainstotheadditionofAWGNwithmeanzeroand%parameter'variance'toaninputsignal.%%AUTHOR:WenbinLuo% DATE:04/12/01%% SYNOPSIS:y=awgn(x,var)%x--->inputsignal%var--->variance%y--->y=x+AWGN%***********************************************************************************functiony=awgn(x,var)w=randn(1,length(x)); w=w-mean(w)*ones(size(w));w=sqrt(var)*(w/std(w));x=x(:);w=w(:);y=x+w;%*************************************************************************************%ThisfunctiondoestheDS-SSmodulation%%AUTHOR:WenbinLuo% DATE:04/28/01%% SYNOPSIS:y=ds_mod(c,x)% c--->usercode(columnvector)%x--->inputsignal(rowvector)%y--->tmp=c*x,y=tmp(:)(ds-ssmodulatedsignal,columnvector)%***********************************************************************************functiony=ds_mod(c,x)tmp=c*x;y=tmp(:);%*************************************************************************************%Thisfunctiongeneratesrandom+1/-1sequencewithindependentidentically% distributedsymbols%%AUTHOR:WenbinLuo% DATE:04/28/01%% SYNOPSIS:x=bingen(L)%L--->numberofrandomsymbols%***********************************************************************************functionx=bingen(L)%generateLsymbolsrandomlywithvalue+1or-1x=rand(1,L);x(find(x<)=-1;x(find(x>=)=1;%*************************************************************************************%ThisfunctiondoestheDS-SSmodulation%%AUTHOR:WenbinLuo% DATE:04/28/01%% SYNOPSIS:x=ds_demod(c,y)% c--->usercode(columnvector)%y--->tmp=c*x,y=tmp(:)(ds-ssmodulatedsignal,columnvector)%x--->inputsignal(rowvector)%***********************************************************************************functionx=ds_demod(c,y)tmp=reshape(y,length(c),length(y)/length(c));tmp=tmp';%xisacolumnvectorx=tmp*c;%converttorowvectorx=x';%*************************************************************************************%ThisfunctiondoestheDS-SSmodulation%%AUTHOR:WenbinLuo% DATE:04/28/01%% SYNOPSIS:y=ds_mod(c,x)% c--->usercode(columnvector)%x--->inputsignal(rowvector)%y--->tmp=c*x,y=tmp(:)(ds-ssmodulatedsignal,columnvector)%***********************************************************************************functiony=ds_mod(c,x)tmp=c*x;y=tmp(:);%***********************************************************%Thismfunctiongeneratesfadedenvelopeandphase%correspondingtoRayleighfading%%AUTHOR:WenbinLuo%DATE:04/27/01%%FUNCTIONSYNOPSIS:%[env,phi]=fade(L,para)%%ParameterDescription:%L:numberofsamplesneeded%variance:variance%**********************************************************function[env,phi]=fade(L,variance)%Errorcheckifvariance<=0error('Positivevarianceneeded')elseifnargin~=2error('Insufficientinputparameters')end%GeneratebivariateGaussianuncorrelated%randomvariablesmu=zeros(1,2);C=variance*eye(2,2);r=mvnrnd(mu,C,L);%Converttopolarcoordinatesandcompute%magnitudeandphasez=r(:,1)+j*r(:,2);env=abs(z);phi=angle(z);%**********************************************************%***********************************************************%Thismfunctiongeneratestwochannelsoffaded%envelopeandphasecorrespondingto%Rayleighfading%%AUTHOR:WenbinLuo%DATE:04/27/01%%FUNCTIONSYNOPSIS:%[env,phi]=fade_diversity(L,para)%%ParameterDescription:%L:numberofsamplesneeded%variance:variance%**********************************************************function[env1,env2]=fade_diversity(L,variance)%Errorcheckifvariance<=0error('Positivevarianceneeded')elseifnargin~=2error('Insufficientinputparameters')end%GeneratebivariateGaussianuncorrelated%randomvariablesmu=zeros(1,4);C=variance*eye(4,4);r=mvnrnd(mu,C,L);%Converttopolarcoordinatesandcompute%magnitudeandphasez1=r(:,1)+j*r(:,2);z2=r(:,3)+j*r(:,4);env1=abs(z1);env2=abs(z2);%**********************************************************%***********************************************************%Thismfunctiongeneratesfrequencyselective%Rayleighfading%%AUTHOR:WenbinLuo%DATE:05/02/01%%FUNCTIONSYNOPSIS:%y=fade_fs(x,L)%%ParameterDescription:% y :outputsignal%x:inputsignal%L :numberofindependentRayleigh% fadingprocess%**********************************************************functiony=fade_fs(x,L)%GeneratebivariateGaussianuncorrelated%randomvariablestmp1=0:1:(L-1);tmp1=exp(-tmp1);tmp(1:2:2*L-1)=tmp1;tmp(2:2:2*L)=tmp1;mu=zeros(1,2*L);C=*diag(tmp);x_len=length(x);r=mvnrnd(mu,C,x_len);%Converttopolarcoordinatesandcomputemagnitudex=x(:);y=zeros(x_len,1);fori=1:L,z=r(:,2*i-1)+j*r(:,2*i);env=abs(z);%phi=angle(z);tmp_y=env.*x;tmp_y=[zeros(i-1,1);tmp_y(1:x_len-i+1)];y=y+tmp_y;end%**********************************************************%**********************************************************************%ThisprogramcomputestheaverageBERofaDS-SS/BPSK% communicationsystemwithbinaryBCHcodeintheAWGNchannel%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%**********************************************************************%functionPlot_Pe=final11_extra()clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=2500;plot_EbNo=-20:2:10;forEbNo=-20:2:10,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);x_org=x;%addserror-correctingcodeenc_N=15;enc_K=5;%7/4or15/5x(find(x<0))=0;x=encode(x,enc_N,enc_K,'bch');x=x';x(find(x==0))=-1;%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactory=sqrt(p)*y;%addAWGNtosignaly=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;%decodeerror-correctingcodex_de(find(x_de<0))=0;x_de=decode(x_de,enc_N,enc_K,'bch');x_de=x_de';x_de(find(x_de==0))=-1;%-------------------------------------Pe=length(find(x_org-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%---------------------------------------------%return;%---------------------------------------------%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/Nosemilogy(plot_EbNo,Plot_Pe,'bo-')xlabel('Eb/No(dB)')ylabel('BER')s=sprintf('BERversusEb/NowithbinaryBCHcodeintheAWGNchannel');title(s);%**********************************************************************%ThisprogramcomputestheaverageBERofaDS-SS/BPSK% communicationsystemwithbinaryBCHcodeintheAWGNchannel%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%**********************************************************************%functionPlot_Pe=final11_extra()clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=2500;plot_EbNo=-20:2:10;forEbNo=-20:2:10,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);x_org=x;%addserror-correctingcodeenc_N=15;enc_K=5;%7/4or15/5x(find(x<0))=0;x=encode(x,enc_N,enc_K,'bch');x=x';x(find(x==0))=-1;%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactory=sqrt(p)*y;%addAWGNtosignaly=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;%decodeerror-correctingcodex_de(find(x_de<0))=0;x_de=decode(x_de,enc_N,enc_K,'bch');x_de=x_de';x_de(find(x_de==0))=-1;%-------------------------------------Pe=length(find(x_org-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%---------------------------------------------%return;%---------------------------------------------%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/Nosemilogy(plot_EbNo,Plot_Pe,'bo-')xlabel('Eb/No(dB)')ylabel('BER')s=sprintf('BERversusEb/NowithbinaryBCHcodeintheAWGNchannel');title(s);%**********************************************************************%ThisprogramcomputestheaverageBERofaDS-SS/BPSK% communicationsystemwithbinaryBCHcodeintheAWGNchannel%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%**********************************************************************%functionPlot_Pe=final11_extra()clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=2500;plot_EbNo=-20:2:10;forEbNo=-20:2:10,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);x_org=x;%addserror-correctingcodeenc_N=15;enc_K=5;%7/4or15/5x(find(x<0))=0;x=encode(x,enc_N,enc_K,'bch');x=x';x(find(x==0))=-1;%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactory=sqrt(p)*y;%addAWGNtosignaly=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;%decodeerror-correctingcodex_de(find(x_de<0))=0;x_de=decode(x_de,enc_N,enc_K,'bch');x_de=x_de';x_de(find(x_de==0))=-1;%-------------------------------------Pe=length(find(x_org-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%---------------------------------------------%return;%---------------------------------------------%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/Nosemilogy(plot_EbNo,Plot_Pe,'bo-')xlabel('Eb/No(dB)')ylabel('BER')s=sprintf('BERversusEb/NowithbinaryBCHcodeintheAWGNchannel');title(s);%*********************************************************************%ThisprogramcomputestheaverageBERofaDS-SS/BPSK% communicationsysteminthepresenceofpulsednoisejamming% andAWGN%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%********************************************************************%functionPlot_Pe=final12()clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;ro=;%1,,x_num=10000;plot_EbNo=-20:2:10;forEbNo=-20:2:10,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactory=sqrt(p)*y;%addPulsedNoiseJammertosignaly=[awgn(y(1:ro*length(y)),1/ro);y((ro*length(y)+1):length(y))];%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%---------------------------------------------%return;%---------------------------------------------%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,'m*-')xlabel('10log_{10}[(P/J)(W/R)](dB)')ylabel('BER')s=sprintf('BERversus10log_{10}[(P/J)(W/R)]inpulsednoisejammingandAWGN');title(s);%*********************************************************************%ThisprogramcomputestheaverageBERofaDS-SS/BPSK% communicationsysteminbarragenoisejammingandAWGN%%AUTHOR:WenbinLuo%DATE:05/02/01%% %%********************************************************************%functionPlot_Pe=final12_extra()clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=10000;%----------------------------------------------------------%convertbackfromdBEb_No=5;%2,4,6dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%----------------------------------------------------------plot_EbNj=0:2:50;forEbNj=0:2:50,%convertbackfromdBEb_Nj=EbNj;%dBEb_Nj=10.^(Eb_Nj/10);Nj=Eb/Eb_Nj;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactory=sqrt(p)*y;%addbarragenoisejammingandAWGNtosignaly=awgn(y,(Nj/2)+1);%y=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%---------------------------------------------%return;%---------------------------------------------%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNj,Plot_Pe,'m*-')xlabel('10log_{10}[(P/J)(W/R)](dB)')ylabel('BER')s=sprintf('BERversus10log_{10}[(P/J)(W/R)]inbarragenoisejammingandAWGN');title(s);gridon;%*********************************************************************%ThisprogramcomputestheaverageBERinRayleighfading% andAWGN%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%********************************************************************%functionPlot_Pe=final21()clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=10000;plot_EbNo=-30:2:30;%-20:2:10;forEbNo=-30:2:30,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);x_original=x;x=sqrt(p)*x;%generateRayleighfading[env,phi]=fade(length(x),;%generatefadedsequencex=env.*x';x=x';%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactor%y=sqrt(p)*y;%addAWGNtosignaly=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x_original-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%---------------------------------------------%return;%---------------------------------------------%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,'r^-')xlabel('Eb/No(dB)')ylabel('BER')s=sprintf('BERversusEb/NoinRayleighfadingandAWGN');title(s);gridon;%*********************************************************************%Thisprogramsimulatesapredetectionselectivecombining% receiverforaRayleighfadingchannel%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%********************************************************************clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=10000;plot_EbNo=-30:2:20;%-20:2:10;forEbNo=-30:2:20,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);x_original=x;x=sqrt(p)*x;%generateRayleighfading[env1,env2]=fade_diversity(length(x),;%generatefadedsequencex_fad1=env1.*x';x_fad1=x_fad1';x_fad2=env2.*x';x_fad2=x_fad2';%DS-SSmodulatesymbolswithusercodec=bingen(N);y_fad1=ds_mod(c(:),x_fad1);y_fad2=ds_mod(c(:),x_fad2);%scalebyappropriatepowerfactor%y=sqrt(p)*y;%addAWGNtosignaly_fad1=awgn(y_fad1,1);y_fad2=awgn(y_fad2,1);%DS-SSdemodulatesymbolswithusercodex_de1=ds_demod(c(:),y_fad1);x_de2=ds_demod(c(:),y_fad2);%choosebranchwithlargerBENRind1=find(abs(x_de1)>=abs(x_de2));ind2=find(abs(x_de1)<abs(x_de2));x_de(ind1)=x_de1(ind1);x_de(ind2)=x_de2(ind2);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x_original-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,'ro-')xlabel('Eb/No(dB)')ylabel('BER')s=sprintf('BERversusEb/NoinRayleighfadingandAWGN');title(s);gridon;%*********************************************************************%ThisprogramcomputestheaverageBERinRayleighfading% andAWGN%%AUTHOR:WenbinLuo%DATE:04/28/01%% %%********************************************************************clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];N=16;x_num=10000;plot_EbNo=-20:2:30;%-20:2:10;forEbNo=-20:2:30,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);x_original=x;x=sqrt(p)*x;%generatefrequencyselectiveRayleighfadingtmp=fade_fs(x,7);x=tmp';%DS-SSmodulatesymbolswithusercodec=bingen(N);y=ds_mod(c(:),x);%scalebyappropriatepowerfactor%y=sqrt(p)*y;%addAWGNtosignaly=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x_original-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,'r*-')xlabel('Eb/No(dB)')ylabel('BER')s=sprintf('BERversusEb/NoinRayleighfadingandAWGN');title(s);gridon;%*********************************************************************%ThisprogramcomputestheaverageBERversusEb/NoofKusers% transmittingBPSKsymbolsatanequalpowerlevelusinga% DS-CDMAschemeassummingperfectsynchronismandorthogonal% codesinAWGN%%AUTHOR:WenbinLuo%DATE:04/29/01%% %%********************************************************************clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];K=16;N=32;x_num=5000;plot_EbNo=-20:3:10;forEbNo=-20:3:10,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);%DS-SSmodulatesymbolswithusercodeUserCode=hadamard(N);c=UserCode(1,:);y=ds_mod(c(:),x);%addotherusers'signalasinterferencefort=2:1:K,tmp_x=bingen(x_num);tmp=UserCode(t,:);tmp_y=ds_mod(tmp(:),tmp_x);y=y+tmp_y;end%t%scalebyappropriatepowerfactory=sqrt(p)*y;%addAWGNtosignaly=awgn(y,1);%DS-SSdemodulatesymbolswithusercodex_de=ds_demod(c(:),y);%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,'m*-')xlabel('Eb/No(dB)')ylabel('BER')title('BERversusEb/NousingDS-CDMA:perfectsynchronismbetweenusers');gridon;%**********************************************************************%ThisprogramcomputestheaverageBERversusEb/NoofKusers% transmittingBPSKsymbolsatanequalpowerlevelusinga% slowFH-MAschemeassummingperfectsynchronismandorthogonal% codesinAWGN%%AUTHOR:WenbinLuo%DATE:05/01/01%% %%*********************************************************************clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];K=16;%4,8,16N=32;x_num=5000;plot_EbNo=-20:3:10;forEbNo=-20:3:10,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);%DS-SSmodulatesymbolswithusercodeUserCode=fh(N,K);c=UserCode(1,:);y=ds_mod(c(:),x);%addotherusers'signalasinterferencefort=2:1:K,tmp_x=bingen(x_num);tmp=UserCode(t,:);tmp_y=ds_mod(tmp(:),tmp_x);y=y+tmp_y;end%t%scalebyappropriatepowerfactory=sqrt(p)*y;%addAWGNtosignaly=awgn_complex(y,1);%DS-SSdemodulatesymbolswithusercodex_de=real(ds_demod(conj(c(:)),y));%decisionx_de(find(x_de<0))=-1;x_de(find(x_de>=0))=1;Pe=length(find(x-x_de))/x_num;Plot_Pe=[Plot_PePe];end%endforEbNo%displaythecalculatedPdandPfaPlot_Pe%plotPeversusEb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,'m*-')xlabel('Eb/No(dB)')ylabel('BER')title('BERversusEb/NousingslowFH-MA:perfectsynchronismbetweenusers');gridon;%*********************************************************************%ThisprogramcomputestheaverageBERversusEb/NoofKusers% transmittingBPSKsymbolsatanequalpowerlevelusinga% DS-CDMAschemeassummingarandomasynchronismbetweenusers%%AUTHOR:WenbinLuo%DATE:04/29/01%% %%********************************************************************clearall;%closeall;formatlong;%setupthethresholdVtVt=0;Plot_Pe=[];K=4;N=32;x_num=30000;%generatesarandomasynchronismbetweenusersasyn=rand(1,K)*6;%asyn=floor(asyn);asyn=floor(asyn)+1;plot_EbNo=-20:3:50;forEbNo=-20:3:50,%convertbackfromdBEb_No=EbNo;%dBEb_No=10.^(Eb_No/10);%assumeNo=2;No=2;Eb=No*Eb_No;%calculatepowerpTc=1;Ts=N*Tc;p=Eb/Ts;%generateBPSKsymbolsrandomlywithvalue+1or-1x=bingen(x_num);%DS-SSmodulatesymbolswithusercodeUserCode=hadamard(N);c=UserCode(1,:);y=ds_mod(

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论