




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、%*% This function pertains to the addition of AWGN with mean zero and % parameter variance to an input signal. % AUTHOR: Wenbin Luo% DATE : 04/12/01% SYNOPSIS: y = awgn(x,var)% x - input signal% var - variance% y - y = x + AWGN %*function y = awgn(x,var) w = randn(1,length(x); w = w - mean(w)*ones(s
2、ize(w); w = sqrt(var)*(w / std(w); x = x(:); w = w(:); y = x + w; %*% This function does the DS-SS modulation% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: y = ds_mod(c,x)% c - user code (column vector)% x - input signal (row vector)% y - tmp = c*x, y = tmp(:) (ds-ss modulated signal, column vecto
3、r)%*function y = ds_mod(c,x)tmp = c*x;y = tmp(:);%*% This function generates random +1/-1 sequence with independent identically % distributed symbols% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: x = bingen(L)% L - number of random symbols %*function x = bingen(L)%generate L symbols randomly with
4、value +1 or -1x = rand(1,L);x(find(x=) = 1;%*% This function does the DS-SS modulation% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: x = ds_demod(c,y)% c - user code (column vector)% y - tmp = c*x, y = tmp(:) (ds-ss modulated signal, column vector)% x - input signal (row vector)%*function x = ds_d
5、emod(c,y)tmp = reshape(y, length(c), length(y)/length(c);tmp = tmp;%x is a column vectorx = tmp * c;% convert to row vectorx = x;%*% This function does the DS-SS modulation% AUTHOR: Wenbin Luo% DATE : 04/28/01% SYNOPSIS: y = ds_mod(c,x)% c - user code (column vector)% x - input signal (row vector)%
6、y - tmp = c*x, y = tmp(:) (ds-ss modulated signal, column vector)%*function y = ds_mod(c,x)tmp = c*x;y = tmp(:);%*% This mfunction generates faded envelope and phase % corresponding to Rayleigh fading% AUTHOR: Wenbin Luo% DATE : 04/27/01% FUNCTION SYNOPSIS: % env,phi = fade(L,para)% % Parameter Desc
7、ription: % L : number of samples needed % variance : variance %*function env,phi = fade(L,variance)% Error checkif variance = 0 error(Positive variance needed)elseif nargin = 2 error(Insufficient input parameters)end% Generate bivariate Gaussian uncorrelated % random variablesmu = zeros(1,2);C = var
8、iance*eye(2,2);r = mvnrnd(mu,C,L);% Convert to polar coordinates and compute % magnitude and phase z = r(:,1) + j*r(:,2);env = abs(z); phi = angle(z);%*%*% This mfunction generates two channels of faded % envelope and phase corresponding to% Rayleigh fading% AUTHOR: Wenbin Luo% DATE : 04/27/01% FUNC
9、TION SYNOPSIS: % env,phi = fade_diversity(L,para)% % Parameter Description: % L : number of samples needed % variance : variance %*function env1,env2 = fade_diversity(L,variance)% Error checkif variance = 0 error(Positive variance needed)elseif nargin = 2 error(Insufficient input parameters)end% Gen
10、erate bivariate Gaussian uncorrelated % random variablesmu = zeros(1,4);C = variance*eye(4,4);r = mvnrnd(mu,C,L);% Convert to polar coordinates and compute % magnitude and phase z1 = r(:,1) + j*r(:,2);z2 = r(:,3) + j*r(:,4);env1 = abs(z1); env2 = abs(z2);%*%*% This mfunction generates frequency sele
11、ctive % Rayleigh fading% AUTHOR: Wenbin Luo% DATE : 05/02/01% FUNCTION SYNOPSIS: % y = fade_fs(x,L)% % Parameter Description: %y : output signal% x : input signal % L : number of independent Rayleigh %fading process %*function y = fade_fs(x,L)% Generate bivariate Gaussian uncorrelated % random varia
12、blestmp1 = 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);% Convert to polar coordinates and compute magnitudex = x(:);y = zeros(x_len,1);for i = 1:L, z = r(:,2*i-1) + j*r(:,2*i); env = abs(z); %phi = an
13、gle(z); tmp_y = env.*x; tmp_y = zeros(i-1,1); tmp_y(1:x_len-i+1); y = y + tmp_y;end%*%*% This program computes the average BER of a DS-SS/BPSK %communication system with binary BCH code in the AWGN channel% % AUTHOR: Wenbin Luo% DATE : 04/28/01% %*%function Plot_Pe = final11_extra()clear all;%close
14、all;format long;%set up the threshold Vt Vt = 0;Plot_Pe = ;N = 16;x_num = 2500;plot_EbNo = -20:2:10;for EbNo = -20:2:10, %convert back from dBEb_No = EbNo; %dBEb_No = 10.(Eb_No/10);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%generate BPSK symbols randomly
15、with value +1 or -1x = bingen(x_num);x_org = x;%adds error-correcting codeenc_N = 15; enc_K = 5; %7/4 or 15/5x(find(x 0) = 0;x = encode(x,enc_N,enc_K,bch);x = x;x(find(x = 0) = -1;%DS-SS modulate symbols with user codec = bingen(N);y = ds_mod(c(:),x);%scale by appropriate power factory = sqrt(p)*y;%
16、add AWGN to signaly = awgn(y,1);%DS-SS demodulate symbols with user codex_de = ds_demod(c(:),y);%decisionx_de(find(x_de =0) = 1;%decode error-correcting codex_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 =
17、 Plot_Pe Pe;end %end for EbNo%-%return;%-%display the calculated Pd and PfaPlot_Pe%plot Pe versus Eb/Nosemilogy(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 %c
18、ommunication system with binary BCH code in the AWGN channel% % AUTHOR: Wenbin Luo% DATE : 04/28/01% %*%function Plot_Pe = final11_extra()clear all;%close all;format long;%set up the threshold Vt Vt = 0;Plot_Pe = ;N = 16;x_num = 2500;plot_EbNo = -20:2:10;for EbNo = -20:2:10, %convert back from dBEb_
19、No = EbNo; %dBEb_No = 10.(Eb_No/10);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%generate BPSK symbols randomly with value +1 or -1x = bingen(x_num);x_org = x;%adds error-correcting codeenc_N = 15; enc_K = 5; %7/4 or 15/5x(find(x 0) = 0;x = encode(x,enc_N,e
20、nc_K,bch);x = x;x(find(x = 0) = -1;%DS-SS modulate symbols with user codec = bingen(N);y = ds_mod(c(:),x);%scale by appropriate power factory = sqrt(p)*y;%add AWGN to signaly = awgn(y,1);%DS-SS demodulate symbols with user codex_de = ds_demod(c(:),y);%decisionx_de(find(x_de =0) = 1;%decode error-cor
21、recting codex_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 PfaPlot_Pe%plot Pe versus Eb/Nosemilogy(plot_EbNo,Plot_Pe,bo-)xlabel(Eb/N
22、o (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 with binary BCH code in the AWGN channel% % AUTHOR: Wenbin Luo% DATE : 04/28/01% %*%function Plot_Pe = final11_extra()clear a
23、ll;%close all;format long;%set up the threshold Vt Vt = 0;Plot_Pe = ;N = 16;x_num = 2500;plot_EbNo = -20:2:10;for EbNo = -20:2:10, %convert back from dBEb_No = EbNo; %dBEb_No = 10.(Eb_No/10);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%generate BPSK symbols
24、 randomly with value +1 or -1x = bingen(x_num);x_org = x;%adds error-correcting codeenc_N = 15; enc_K = 5; %7/4 or 15/5x(find(x 0) = 0;x = encode(x,enc_N,enc_K,bch);x = x;x(find(x = 0) = -1;%DS-SS modulate symbols with user codec = bingen(N);y = ds_mod(c(:),x);%scale by appropriate power factory = s
25、qrt(p)*y;%add AWGN to signaly = awgn(y,1);%DS-SS demodulate symbols with user codex_de = ds_demod(c(:),y);%decisionx_de(find(x_de =0) = 1;%decode error-correcting codex_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
26、;Plot_Pe = Plot_Pe Pe;end %end for EbNo%-%return;%-%display the calculated Pd and PfaPlot_Pe%plot Pe versus Eb/Nosemilogy(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-
27、SS/BPSK %communication system in the presence of pulsed noise jamming%and AWGN% % AUTHOR: Wenbin Luo% DATE : 04/28/01% %*%function Plot_Pe = final12()clear all;%close all;format long;%set up the threshold Vt Vt = 0;Plot_Pe = ;N = 16;ro = ; %1, , x_num = 10000;plot_EbNo = -20:2:10; for EbNo = -20:2:1
28、0, %convert back from dBEb_No = EbNo; %dBEb_No = 10.(Eb_No/10);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%generate BPSK symbols randomly with value +1 or -1x = bingen(x_num);%DS-SS modulate symbols with user codec = bingen(N);y = ds_mod(c(:),x);%scale by
29、appropriate power factory = sqrt(p)*y;%add Pulsed Noise Jammer to signaly = awgn(y(1:ro*length(y),1/ro); y(ro*length(y)+1):length(y);%DS-SS demodulate symbols with user codex_de = ds_demod(c(:),y);%decisionx_de(find(x_de =0) = 1;Pe = length(find(x - x_de)/x_num;Plot_Pe = Plot_Pe Pe;end %end for EbNo
30、%-%return;%-%display the calculated Pd and PfaPlot_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/BPS
31、K %communication system in barrage noise jamming and AWGN% % AUTHOR: Wenbin Luo% DATE : 05/02/01% %*% 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 dBEb_No = 5; % 2, 4, 6 dB Eb_No = 10.(Eb_No/10
32、);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%-plot_EbNj = 0:2:50; for EbNj = 0:2:50, %convert back from dBEb_Nj = EbNj; %dBEb_Nj = 10.(Eb_Nj/10);Nj = Eb / Eb_Nj; %generate BPSK symbols randomly with value +1 or -1x = bingen(x_num);%DS-SS modulate symbols
33、with user codec = bingen(N);y = ds_mod(c(:),x);%scale by appropriate power factory = sqrt(p)*y;%add barrage noise jamming and AWGN to signaly = awgn(y,(Nj/2)+1);%y = awgn(y,1);%DS-SS demodulate symbols with user codex_de = ds_demod(c(:),y);%decisionx_de(find(x_de =0) = 1;Pe = length(find(x - x_de)/x
34、_num;Plot_Pe = Plot_Pe Pe;end %end for EbNo%-%return;%-%display the calculated Pd and PfaPlot_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;%*%
35、This program computes the average BER in Rayleigh fading %and AWGN% % AUTHOR: Wenbin Luo% DATE : 04/28/01% %*%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, %convert bac
36、k from dBEb_No = EbNo; %dBEb_No = 10.(Eb_No/10);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%generate BPSK symbols randomly with value +1 or -1x = bingen(x_num);x_original = x;x = sqrt(p)*x;%generate Rayleigh fadingenv,phi = fade(length(x),;%generate faded
37、sequencex = env.*x;x = x;%DS-SS modulate symbols with user codec = bingen(N);y = ds_mod(c(:),x);%scale by appropriate power factor%y = sqrt(p)*y;%add AWGN to signaly = awgn(y,1);%DS-SS demodulate symbols with user codex_de = ds_demod(c(:),y);%decisionx_de(find(x_de =0) = 1;Pe = length(find(x_origina
38、l - x_de)/x_num;Plot_Pe = Plot_Pe Pe;end %end for EbNo%-%return;%-%display the calculated Pd and PfaPlot_Pe%plot Pe versus Eb/No%subplot(2,1,1)semilogy(plot_EbNo,Plot_Pe,r-)xlabel(Eb/No (dB)ylabel(BER)s=sprintf(BER versus Eb/No in Rayleigh fading and AWGN);title(s);grid on;%*% This program simulates
39、 a predetection selective combining%receiver for a Rayleigh fading channel % % AUTHOR: Wenbin Luo% DATE : 04/28/01% %*clear all;%close all;format long;%set up the threshold Vt Vt = 0;Plot_Pe = ;N = 16;x_num = 10000;plot_EbNo = -30:2:20; %-20:2:10;for EbNo = -30:2:20, %convert back from dBEb_No = EbN
40、o; %dBEb_No = 10.(Eb_No/10);%assume No = 2;No = 2;Eb = No * Eb_No;%calculate power pTc = 1;Ts = N * Tc;p = Eb / Ts;%generate BPSK symbols randomly with value +1 or -1x = bingen(x_num);x_original = x;x = sqrt(p)*x;%generate Rayleigh fadingenv1,env2 = fade_diversity(length(x),;%generate faded sequence
41、x_fad1 = env1.*x;x_fad1 = x_fad1;x_fad2 = env2.*x;x_fad2 = x_fad2;%DS-SS modulate symbols with user codec = bingen(N);y_fad1 = ds_mod(c(:),x_fad1);y_fad2 = ds_mod(c(:),x_fad2);%scale by appropriate power factor%y = sqrt(p)*y;%add AWGN to signaly_fad1 = awgn(y_fad1,1);y_fad2 = awgn(y_fad2,1);%DS-SS demodulate symbols
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 加強城市公共設(shè)施安全管理計劃
- 2025年智能馬桶蓋合作協(xié)議書
- 2025年高模量玻璃纖維紗項目發(fā)展計劃
- 移動支付系統(tǒng)研發(fā)合作協(xié)議
- 從寓言故事看中華傳統(tǒng)美德的傳承與教育
- 公司信息化安全規(guī)章制度及操作手冊
- racemic-Nornicotine-Standard-生命科學(xué)試劑-MCE
- 班主任與學(xué)生家長安全協(xié)議書
- Cholesterol-n-Octanoate-Standard-生命科學(xué)試劑-MCE
- 5-Bromo-6-chloropyrazin-2-amine-生命科學(xué)試劑-MCE
- 電梯口包邊施工方案正式
- 部編版六年級道德與法治下冊《學(xué)會反思》教案
- 三年級道德與法治下冊我是獨特的
- 部編版四年級下冊語文教案(完整)
- T∕CIS 71001-2021 化工安全儀表系統(tǒng)安全要求規(guī)格書編制導(dǎo)則
- 青年卒中 幻燈
- 典型倒閘操作票
- 第七章 化學(xué)物質(zhì)與酶的相互作用
- 機械畢業(yè)設(shè)計論文鋼筋自動折彎機的結(jié)構(gòu)設(shè)計全套圖紙
- 綜采工作面順槽頂板退錨安全技術(shù)措施
- 中國電機工程學(xué)報論文格式模板
評論
0/150
提交評論