基于MATLAB的扩频通信系统仿真毕业论文 联系客服

发布时间 : 星期日 文章基于MATLAB的扩频通信系统仿真毕业论文更新完毕开始阅读a0cd7397ff00bed5b9f31da6

黄河科技学院毕业论文 第

fid = fopen('BER.dat','a');

30 页

fprintf('%d\\t%d\\t%d\\t%e\\n',ebn0,noe,nod,noe/nod);

fprintf(fid,'%d\\t%e\\t%f\\t%f\\t\\n',ebn0,noe/nod,noe,nod); fclose(fid);

err_rate_final(ebn0+6)=ber; end

%性能仿真图 figure

semilogy(SNR,err_rate_final,'b-*'); xlabel('信噪比/dB') ylabel('误码率') axis([-5,10,0,1]) grid on

初始化设置以及仿真循环设置

Main函数为 clear all; clc

sr = 256000.0; % 符号速率 ml = 2; % 调制阶数 br = sr * ml; % 比特速率 nd = 100; % 符号数 SNR=-5:1:10; % Eb/No

%**************************扩频码初值设定************** user = 1; % 用户数 stage = 3; % 序列阶数

ptap1 = [1 3]; % 第一个线性移位寄存器的系数

黄河科技学院毕业论文 第

disp('--------------start-------------------');

%******************扩频码的产生****************** for ebn0=-5:1:10 % m序列 code = mseq(stage,ptap1,regi1,user); code = code * 2 - 1; clen = length(code);

%******************仿真运算开始******************

31 页

nloop = 1000; % 仿真循环次数 noe = 0; nod = 0; for ii=1:nloop

%******************发射机****************** data = rand(user,nd*ml) > 0.5;

[ich, qch] = qpskmod(data,user,nd,ml); % QPSK 调制

[ich1,qch1] = spread(ich,qch,code); % 扩频 ich2 = ich1; qch2 = qch1;

%******************接收机******************

[ich3,qch3] = comb2(ich2,qch2,attn); % 添加高斯白噪声(AWGN)

sampl = irfn * IPOINT + 1;

ich4 = ich3(:,sampl:IPOINT:IPOINT*nd*clen+sampl-1); qch4 = qch3(:,sampl:IPOINT:IPOINT*nd*clen+sampl-1); [ich5 qch5] = despread(ich4,qch4,code); % 解扩 demodata = qpskdemod(ich5,qch5,user,nd,ml); % QPSK解调 %******************误码率分析****************** noe2 = sum(sum(abs(data-demodata))); nod2 = user * nd * ml; noe = noe + noe2;

黄河科技学院毕业论文 第

nod = nod + nod2;

%******************数据文件****************** ber = noe / nod;

32 页

fprintf('%d\\t%d\\t%d\\t%e\\n',ebn0,noe,nod,noe/nod); fid = fopen('BER.dat','a');

fprintf(fid,'%d\\t%e\\t%f\\t%f\\t\\n',ebn0,noe/nod,noe,nod); fclose(fid);

err_rate_final(ebn0+6)=ber;

%******************性能仿真图****************** figure

semilogy(SNR,err_rate_final,'b-*'); xlabel('信噪比/dB') ylabel('误码率') axis([-5,10,0,1]) grid on

disp('--------------end-------------------');