cdma的MATLAB仿真源程序(3)

2019-04-21 14:12

x_de = ds_demod(c(:),y);

Tcision

x_de(find(x_de < 0)) = -1; x_de(find(x_de >=0)) = 1;

Tcode error-correcting code x_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_Pe Pe]; end %end for EbNo

%--------------------------------------------- %return;

%---------------------------------------------

%display the calculated Pd and Pfa Plot_Pe

%plot Pe versus Eb/No

semilogy(plot_EbNo,Plot_Pe,'bo-') xlabel('Eb/No (dB)') ylabel('BER')

s=sprintf('BER versus Eb/No with binary BCH code in the AWGN channel'); title(s);

%********************************************************************* % This program computes the average BER of a DS-SS/BPSK % communication system in the presence of pulsed noise jamming % and AWGN %

% AUTHOR: Wenbin Luo % DATE : 04/28/01 % % final12.m %

%********************************************************************

%function Plot_Pe = final12()

clear all; %close all;

format long;

%set up the threshold Vt Vt = 0;

Plot_Pe = [];

N = 16;

ro = 0.2; %1, 0.4, 0.2 x_num = 10000;

plot_EbNo = -20:2:10; for EbNo = -20:2:10,

%convert back from dB Eb_No = EbNo; ?

Eb_No = 10.^(Eb_No/10); %assume No = 2; No = 2;

Eb = No * Eb_No; êlculate power p Tc = 1; Ts = N * Tc; p = Eb / Ts;

%generate BPSK symbols randomly with value +1 or -1 x = bingen(x_num);

%DS-SS modulate symbols with user code c = bingen(N); y = ds_mod(c(:),x);

%scale by appropriate power factor y = sqrt(p)*y;

-d Pulsed Noise Jammer to signal

y = [awgn(y(1:ro*length(y)),1/ro); y((ro*length(y)+1):length(y))];

%DS-SS demodulate symbols with user code x_de = ds_demod(c(:),y);

Tcision

x_de(find(x_de < 0)) = -1;

x_de(find(x_de >=0)) = 1;

Pe = length(find(x - x_de))/x_num; Plot_Pe = [Plot_Pe Pe]; end %end for EbNo

%--------------------------------------------- %return;

%---------------------------------------------

%display the calculated Pd and Pfa Plot_Pe

%plot Pe versus Eb/No %subplot(2,1,1)

semilogy(plot_EbNo,Plot_Pe,'m*-') xlabel('10log_{10}[(P/J)(W/R)] (dB)') ylabel('BER')

s=sprintf('BER versus 10log_{10}[(P/J)(W/R)] in pulsed noise jamming and AWGN'); title(s);

%********************************************************************* % This program computes the average BER of a DS-SS/BPSK % communication system in barrage noise jamming and AWGN %

% AUTHOR: Wenbin Luo % DATE : 05/02/01 % % final12_extra.m %

%********************************************************************

% function Plot_Pe = final12_extra()

clear all; %close all;

format long;

%set up the threshold Vt Vt = 0;

Plot_Pe = [];

N = 16;

x_num = 10000;

%---------------------------------------------------------- %convert back from dB Eb_No = 5; % 2, 4, 6 dB Eb_No = 10.^(Eb_No/10); %assume No = 2; No = 2;

Eb = No * Eb_No; êlculate power p Tc = 1; Ts = N * Tc; p = Eb / Ts;

%----------------------------------------------------------

plot_EbNj = 0:2:50; for EbNj = 0:2:50,

%convert back from dB Eb_Nj = EbNj; ?

Eb_Nj = 10.^(Eb_Nj/10); Nj = Eb / Eb_Nj;

%generate BPSK symbols randomly with value +1 or -1 x = bingen(x_num);

%DS-SS modulate symbols with user code c = bingen(N); y = ds_mod(c(:),x);

%scale by appropriate power factor y = sqrt(p)*y;

-d barrage noise jamming and AWGN to signal y = awgn(y,(Nj/2)+1); %y = awgn(y,1);

%DS-SS demodulate symbols with user code x_de = ds_demod(c(:),y);

Tcision

x_de(find(x_de < 0)) = -1; x_de(find(x_de >=0)) = 1;

Pe = length(find(x - x_de))/x_num;

Plot_Pe = [Plot_Pe Pe]; end %end for EbNo

%--------------------------------------------- %return;

%---------------------------------------------

%display the calculated Pd and Pfa Plot_Pe

%plot Pe versus Eb/No %subplot(2,1,1)

semilogy(plot_EbNj,Plot_Pe,'m*-') xlabel('10log_{10}[(P/J)(W/R)] (dB)') ylabel('BER')

s=sprintf('BER versus 10log_{10}[(P/J)(W/R)] in barrage noise jamming and AWGN'); title(s); grid on;

%********************************************************************* % This program computes the average BER in Rayleigh fading % and AWGN %

% AUTHOR: Wenbin Luo % DATE : 04/28/01 % % final21.m %

%********************************************************************

%function Plot_Pe = final21()

clear all; %close all;

format long;

%set up the threshold Vt Vt = 0;

Plot_Pe = [];

N = 16;

x_num = 10000;

plot_EbNo = -30:2:30; %-20:2:10; for EbNo = -30:2:30,


cdma的MATLAB仿真源程序(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:非谓语动词用法详解

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: