cdma的MATLAB仿真源程序_第1頁
cdma的MATLAB仿真源程序_第2頁
cdma的MATLAB仿真源程序_第3頁
cdma的MATLAB仿真源程序_第4頁
cdma的MATLAB仿真源程序_第5頁
已閱讀5頁,還剩32頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

cdma的MATLAB仿真源程序cdma的MATLAB仿真源程序cdma的MATLAB仿真源程序xxx公司cdma的MATLAB仿真源程序文件編號:文件日期:修訂次數(shù):第1.0次更改批準(zhǔn)審核制定方案設(shè)計,管理制度%*************************************************************************************%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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論