通信原理课程设计—DS-CDMA基带传输系统

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

通信原理课程设计——DS/CDMA基带传输系统一、课程设计要求:用Matlab构造一个DS/CDMA基带传输系统,各用户的二进制数据b与扩频码c进行扩频,用户数K为4个,扩频增益取31,扩频码采用Gold码,接收端假设理想同步,对各用户通过解扩恢复各自的信息数据。发端基带成型采用滚降因子为0.22的平方根升余弦滚降脉冲(用48阶的FIR滤波器来实现,每个码片采样16个样点),接收机用码片第8个或第9个样点作为判决点,信噪比大小(SNR)自设,如SNR可取为20dB或30dB。解扩抽样判决nt2cKc1c1b2bKbrtˆib基带成型匹配滤波抽样判决二、DS/CDMA原理:DS/CDMA(DirectSequence/CodeDivisionMultipleAccess)即直接序列码分多址。DS-CDMA是通过将携带信息的窄带信号与高速地址码信号相乘而获得的宽带扩频信号。收端需要用与发端同步的相同地址码信号去控制输入变频器的载频相位即可实现解扩。DS-CDMA系统具有抗窄带干扰、抗多径衰落和保密性好的优点。DS/CDMA其余优点:许多用户可以共享频率资源,无须复杂的频率分配和管理;具有软容量特性,即在一定限度内的用户数增加,只会使得信噪比下降,而不会终止通信,也就是说DS/CDMA没有绝对的容量限制。DS/CDMA系统原理框图如下:扩频调制伪码发生器载波发生器解调伪码发生器同步解扩高放混频本振信源三、系统设计:根升余弦滤波器设计:irfn=48;%滤波器阶数IPOINT=4;%码片速率过采样倍数(4倍alfs=0.22;%滚降因子[xh]=hrollfcoef(irfn,IPOINT,sr,alfs,1);%发送端根升余弦滤波器系数[xh2]=hrollfcoef(irfn,IPOINT,sr,alfs,0);%接收端根升余弦滤波器系数%根升余弦滤波器figure('Name','根升余弦滤波器','NumberTitle','on');%Txsubplot(211);stem(xh);grid;xlabel('Bitsindex');title('发送端根升余弦滤波器');%Rxsubplot(212);stem(xh2);grid;xlabel('Bitsindex');title('接收端根升余弦滤波器');误码率-信噪比关系图figure;%plottheBERvs.SNRsemilogy(SNR,r,'r-x'),grid;xlabel('SNR');ylabel('BER');title('BERvs.SNR');原始数据,发送和接收的比较figure('Name','OriginalData','NumberTitle','on');%plotdataforarandomlyselectedusersuchasuserno.1beforetheBPSKmappingTxandRx%Txsubplot(211);stem(data(cuser,1:20),'filled');grid;xlabel('Bitsindex');title('TransmittedBits(showingonly20bits)');%Rxsubplot(212);stem(data_rm(cuser,1:20),'filled');grid;xlabel('Bitsindex');title('ReceivedBits(showingonly20bits)');BPSK编码后,发送和接收的比较figure('Name','BPSKSymbols','NumberTitle','on');%plotdataforarandomlyselectedusersuchasuserno.1aftertheBPSKmappingTxandRx%Txsubplot(211);stem(data_m(cuser,1:20),'filled');grid;xlabel('Symbolindex');title('TransmittedBPSKSymbols(showingonly20Symbol)');%Rxsubplot(212);stem(data_rs(cuser,1:20),'filled');grid;xlabel('Symbolindex');title('ReceivedBPSKSymbols(showingonly20Symbol)');要发送的数据,各个用户对应位求和的结果figure('Name','Combinedsignals','NumberTitle','on');%plotcombinedsignals%Txsubplot(211);stem(data_f(1:50),'filled');title('Combinedsignals(only20symbols)');xlabel('IndexofCombinedsymbols');ylabel('Magnitude');grid;%Rxsubplot(212);stem(data_ros(1:50),'filled');title('Combinednoisysignals(only20symbols)');xlabel('IndexofCombinedsymbols');ylabel('Magnitude');四、程序代码:%main_DS_CDMA.m%DS/CDMA通信系统仿真%扩频码:Gold码%+++++++++++++++++++++++准备部分+++++++++++++++++++++++++++clearall;closeall;clc;disp('--------------CalculateStart...-------------------');sr=256000.0;%符号速率ml=2;%调制阶数br=sr*ml;%比特速率nd=1000;%符号数SNR=-5:1:10;%Eb/No:Eb是指平和比特能量,no是指白噪声的功率谱密度cuser=1;%画图时要显示的用户%+++++++++++++++++++++滤波器初值设定+++++++++++++++++++++++irfn=48;%滤波器阶数IPOINT=4;%码片速率过采样倍数(4倍alfs=0.22;%滚降因子[xh]=hrollfcoef(irfn,IPOINT,sr,alfs,1);%发送端根升余弦滤波器系数%%hrollfcoef指[xh2]=hrollfcoef(irfn,IPOINT,sr,alfs,0);%接收端根升余弦滤波器系数%++++++++++++++++++++++++扩频码初值设定+++++++++++++++++++user=4;%用户数%seq=2;%1:m序列2:Gold序列3:正交Gold序列stage=5;%序列阶数ptap1=[25];%第一个线性移位寄存器的系数ptap2=[1235];%第二个线性移位寄存器的系数regi1=[11111];%第一个线性移位寄存器的初始化regi2=[11111];%第二个线性移位寄存器的初始化%移位寄存器级数3,码长7.%531%+++++++++++++++++扩频码的产生+++++++++++++++++m1=mseq(stage,ptap1,regi1);m2=mseq(stage,ptap2,regi2);code=[goldseq(m1,m2,user),zeros(user,1)];%正交Gold序列code=code*2-1;%双极性clen=length(code);data=rand(user,nd)0.5;dlen=length(data);data_m=data.*2-1;%QPSK;data_s=zeros(user,dlen*(2^stage));fori1=1:1:user%扩频data_s(i1,:)=kron(data_m(i1,:),code(i1,:));enddata_os=compoversamp2(data_s,IPOINT);%过采样data_f1=compconv2(data_os,xh);%滤波ifuser==1data_f=data_f1;elsedata_f=sum(data_f1);enddisp('--------------SendData...-------------------');loo=0;forkk=1:1:length(SNR)data_n=awgn(data_f,SNR(kk),'measured');%在信号data_f中加入高斯白噪声data_rf=compconv2(data_n,xh2);%滤波sampl=irfn*IPOINT+1;data_ros=data_rf(:,sampl:IPOINT:IPOINT*nd*clen+sampl-1);%减采样%++++++++++解扩++++++++data_rs=zeros(user,dlen);scused=ones(1,dlen);fori2=1:1:userbds=kron(scused,code(i2,:));%将Gold码矩阵的i2行,复制scused次ds=bds.*data_ros(1,:);%反哈达玛变换(解扩)rds=reshape(ds,clen,length(data_ros(1,:))/clen);%对ds重新排列成hl行,length(s)/hl。%注:(reshape数据排列顺序:从上往下,从左往右)ou=sum(rds);%对每列求和t=length(ou);en=zeros(1,t);fora=1:tifou(a)1%抽样判决en(a)=1;elseen(a)=-1;endenddata_rs(i2,:)=en;end%++++++++++++++++++data_rm=(data_rs+1)./2;%BPSK解调loo=loo+1;[n(loo),r(loo)]=symerr(data_m,data_rs);%[number,ratio]=symerr(x,y)enddisp('----------------CalculateFinished-------------------');disp('----------------StartPlot-------------------');%根升余弦滤波器figure('Name','根升余弦滤波器','NumberTitle','on');%Txsubplot(211);stem(xh);grid;xlabel('Bitsindex');title('发送端根升余弦滤波器');%Rxsubplot(212);stem(xh2);grid;xlabel('Bitsindex');title('接收端根升余弦滤波器');%误码率-信噪比关系图figure;%plottheBERvs.SNRsemilogy(SNR,r,'r-x'),grid;xlabel('SNR');ylabel('BER');title('BERvs.SNR');%原始数据,发送和接收的比较figure('Name','OriginalData','NumberTitle','on');%plotdataforarandomlyselectedusersuchasuserno.1beforetheBPSKmappingTxandRx%Txsubplot(211);stem(data(cuser,1:20),'filled');grid;xlabel('Bitsindex');title('TransmittedBits(showingonly20bits)');%Rxsubplot(212);stem(data_rm(cuser,1:20),'filled');grid;xlabel('Bitsindex');title('ReceivedBits(showingonly20bits)');%BPS

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功