亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? prog1.m

?? ber vs snr for awgn-rayleigh channel
?? M
字號:
%Part of Telecommunication simulations course, Spring 2006
%Harri Saarnisaari, CWC
%We simulate uncoded BER of BPSK modulated
%data as a function of SNR
%-in an AWGN channel
%-in a Rayleigh fading channel
%-in an AWGN channel when direct sequence spreading
%is used
%and compare results to the theoretical ones.
%We assume coherent receiver and perfect
%synchronization.
%-------------------------------------------------
%set used SNR values
%SNR (Eb/No) values in decibels
SNR=[0:2:14]'; %column vector
%SNR in linear scale
snr=10.^(SNR/10);
%-------------------------------------------------
%we create initial zero vectors for BER
BER1=zeros(length(SNR),1);
BER2=BER1;
BER3=BER1;
%-----------------------------------------------
%we need a DS-code, we create a random, complex
%one,
length Nc
%elements +-1 +- j*1
Nc=32;
%note that all parameters are defined as variables
%their change afterwards is easy
%(no need to change it every place, just once)
ds=(2*round(rand(Nc,1))-1)+j*(2*round(rand(Nc,1))-1);
%ds-code
%plot the ds signal
plot([real(ds) imag(ds)]),
axis([0 Nc -1.1 1.1])
title('real and imaginary parts of DS code'),
legend('real','imag'),pause
%--------------------------------------------------
%we use symbol energy normalized to 1
%thus, DS energy is normalized to 1 (it is a pulse waveform)

ds=ds/norm(ds);
%check this
ds_energy=norm(ds)^2,pause
%(NOTE: normalization is a usual trick)
%--------------------------------------------------
%Monte Carlo loop starts here
%some initial values
%totally Nmax symbols
Nmax=1000; %maximum number of iterations
Nerr=100; %minimum number of errors
for k=1:length(SNR), %we do MC trials for each SNR
for l=1:Nmax, %MC loop
%-------------------------------------------------
%DATA
%we create data as vectors of length Ns symbols
%and thus use MATLAB's vector processing capabilities

%in addition to for loops (since too long vectors are problems to some
%versions of MATLAB)
Ns=100;
data=2*round(rand(Ns,1))-1;
%data is random and generated again and again for each MC trial

%--------------------------------------------------
%totally Ns * Nmax symbols, if 100*1000 = 100 000
%results rather reliable down to 1e-4
%-------------------------------------------------
%plot data
if l==1 & k==1, %we plot/see things only once, at the first round

plot(data),title('data'),axis([0 Ns -1.1 1.1]),pause,

end
%-------------------------------------------------
%MODULATION
%BPSK signal
bpsk=data;
%DS spread signal
DS=kron(data,ds); %length Ns*Nc
%( kron: Kronecker product, element matrices of
%kron(A,B) are A(i,j)B )
%----------------------------------------------
%plot first 2 symbols of ds-modulated signal
if l==1 & k==1
plot([real(DS) imag(DS)]),title('2 symbols of DS modulated signal'),

axis([0 2*Nc -1/sqrt(Nc) 1/sqrt(Nc)]),pause,
end
%-------------------------------------------------
%CHANNELS
%This is the place to set SNR.
%Since symbol energy is 1 and noise variance is 1,
%SNR of symbol/noise sample is 0 dB.
%Thus, we have to multiply symbol or divide noise to obtain desired SNR.

%Since snr is power variable we have to multiply/divide by

%sqrt(snr) to have amplitude coefficient.
%------------------------------------------------
%noise gereration
%for BPSK
n=1/sqrt(2)*(randn(Ns,1)+j*randn(Ns,1));
%Since complex noise is generated by two real noise sequences the

%total variance is 2 x variance of one sequence (now 1). If we multiply
%by 1/sqrt(2) the total variance of noise becomes 1.

%This is two sided noise spectral density No in BER equations.

%we check this
if l==1 & k==1,
var_n=norm(n)^2, pause
end
%This should be Ns since we sum Ns variables.
%Since n is a realization of a random process,
%the result is not exact.
%Average of repeated trials gives more exact result.

%---------------------------------------------------
%noise for DS-BPSK
%Since signal is longer (by factor Nc) we need different noise

n2=1/sqrt(2)*(randn(Ns*Nc,1)+j*randn(Ns*Nc,1));
%noise is random and we generate it again and again for each MC trial

%---------------------------------------------------
%AWGN BPSK
Bpsk=sqrt(snr(k))*data+n; %snr is Eb/N0 in BER equations
if l==1 & k==1,
plot([real(Bpsk) data])
legend('real part of signal','data'),
title('BPSK signal in noise'),pause
end
%--------------------------------------------
%AWGN DS-BPSK
Ds=sqrt(snr(k))*DS+n2;
%(this works since DS energy is normalized to 1)
%---------------------------------------------
%Rayleigh fading BPSK signal
%first we create taps for each symbol
taps=1/sqrt(2)*(randn(Ns,1)+j*randn(Ns,1));
%these are zero mean unit variance complex Gaussian variables
Bpsk_r=sqrt(snr(k))*abs(taps).*data+n; %SIGNAL
%notice usage of elementwise vector or matrix product .*
if l==1 & k==1,
plot([real(Bpsk_r) data])
legend('real part of signal','data'),
title('BPSK signal in noise & fading channel'),pause
end
%-------------------------------------------------
%difference between AWGN and Rayleigh channel
if l==1 & k==1,
plot(abs([Bpsk Bpsk_r]))
legend('AWGN','RAYLEIGH'),
title('BPSK in AWGN & Rayleigh fading channel'),pause
end
%variations on envelope are larger in fading channels

%deeper nulls and also higher peaks
%---------------------------------------------------
%DEMODULATION
%you have to know how these signals are demodulated
%coherent + synchronized reception
%---------------------------------------------------
%BPSK
r1=real(Bpsk); %demodulated signal, soft decision
%because phase is 0, if phase is h
%r1=real(Bpsk*exp(-j*2*pi*h)); i.e., phase is cancelled

%--------------------------------------------------
%BPSK in fading channel
r2=real(Bpsk_r);
%------------------------------------------------
%DS-BPSK
%here we need MF to the DS code before taking the real part

%different ways to do it
%we select correlation approach where each code length block is

%multiplied by complex conjugate of the code
for v=1:Ns, %we have Ns blocks
r3(v)=real(ds'*Ds((v-1)*Nc+1:v*Nc));
end
r3=r3(:);
%---------------------------------------------------
%demodulated symbols are actually MF output peaks
%separated by Nc samples
if l==1 & k==1,
plot(real(filter(conj(ds(Nc:-1:1)),1,DS)))
legend('without noise')
title('DS-BPSK signal after MF over 6 symbols'),
axis([0 6*Nc -3 3]),pause
end
%-------------------------------------------------
%different demodulated symbols
if l==1 & k==1,
plot([r1 r2 r3])
legend('AWGN','Rayleigh','DS'),
title('demodulated symbols'),pause
end
%BPSK and DS are close (as they should be)
%we can run this at high SNR to see it closely
%---------------------------------------------
%hard decisions, converts soft demodulated symbols to sequence of +-1

%AWGN
d1=find(r1>=0);d2=find(r1<0);
r1(d1)=1;r1(d2)=-1;
%Rayl
d1=find(r2>=0);d2=find(r2<0);
r2(d1)=1;r2(d2)=-1;
%DS
d1=find(r3>=0);d2=find(r3<0);
r3(d1)=1;r3(d2)=-1;
%plot example
if l==1 & k==1,
plot([r1 r2 r3])
legend('AWGN','Rayleigh','DS'),
axis([0 Ns -1.1 1.1]),
title('demodulated symbols after hard decisions')
pause
end
%--------------------------------------------------
%BER analysis
%errors in the current MC run
Ber1=length(find((data-r1)~=0)); %number of errors in AWGN

Ber2=length(find((data-r2)~=0)); %number of errors in Rayleigh

Ber3=length(find((data-r3)~=0)); %number of errors in DS-BPSK

if k==1 & l==1,
errors=[Ber1 Ber2 Ber3],pause
end
%---------------------------------------------------
%we add errors to previous error counts, initially zero

%index k is for SNRs
BER1(k)=BER1(k)+Ber1; %AWGN
BER2(k)=BER2(k)+Ber2; %Rayleigh
BER3(k)=BER3(k)+Ber3; %DS-BPSK
%-------------------------------------------------
%we stop MC trials if minimum number of errors is
%obtained in all systems
if BER1(k)>Nerr & BER2(k)>Nerr & BER3(k)>Nerr,break
 %terminates the innermost loop
end
end %end MC
%------------------------------------------------
%we calculate BER by dividing number of successful trials

%by their total number
BER1(k)=BER1(k)/Ns/l;
BER2(k)=BER2(k)/Ns/l;
BER3(k)=BER3(k)/Ns/l;
end %ends SNR loop
%--------------------------------------------------
%all simulated BERs and corresponding SNR in a matrix

BER=[[SNR] [BER1] [BER2] [BER3]];
%------------------------------------------------
%finally we compute theoretical values and compare them to simulation
%results

%AWGN BER is function of sqrt(2*SNR)
The_awgn=.5*erfc(sqrt(2*snr)/sqrt(2));
%Rayleigh BER is different function of SNR
The_rayl=.5*(1-sqrt(snr./(1+snr)));
%note elementwise division ./
%-------------------------------------------------
%logarithmic plot (y-axis)
semilogy(SNR,[The_awgn The_rayl BER1 BER2 BER3])
xlabel('SNR [dB]')
ylabel('BER')
axis([0 SNR(length(SNR)) 1e-6 .5])
grid on
legend('Theor AWGN','TheorRayl.','AWGN','Rayl.','DS-BPSK')

%simulated and theoretical results are close,especially if total number of
%symbols is large enough
%BPSK and DS-BPSK perform similarly (as they should now)
%Rayleigh fading channel is much more difficult environment than AWGN
%to 10 W

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美国产小视频| 99国产欧美久久久精品| 国产成人欧美日韩在线电影| 成人午夜碰碰视频| 欧美特级限制片免费在线观看| 欧美一卡二卡三卡| 中文字幕不卡的av| 亚洲国产日韩综合久久精品| 韩国精品在线观看| 97久久久精品综合88久久| 欧美精品色综合| 国产三级精品三级| 午夜精品成人在线| 丁香另类激情小说| 69p69国产精品| 日韩理论在线观看| 久久超级碰视频| 91老司机福利 在线| 制服.丝袜.亚洲.中文.综合| 国产精品网站在线播放| 亚洲成av人片| 不卡欧美aaaaa| 欧美r级电影在线观看| 亚洲资源中文字幕| 国产精品亚洲а∨天堂免在线| 欧美中文字幕久久| 国产亚洲污的网站| 日韩和欧美一区二区三区| 99久久精品国产精品久久| 欧美va亚洲va香蕉在线| 亚洲午夜久久久久| 成人av免费在线| 日韩欧美一级精品久久| 亚洲男人的天堂在线观看| 国产麻豆午夜三级精品| 88在线观看91蜜桃国自产| 亚洲欧美另类久久久精品| 国产高清一区日本| 欧美mv和日韩mv的网站| 天天综合网天天综合色| 色八戒一区二区三区| 国产丝袜在线精品| 精品一区二区三区香蕉蜜桃| 欧美日免费三级在线| 亚洲精品日韩一| 成人精品小蝌蚪| 久久久精品综合| 日韩成人午夜精品| 欧美人伦禁忌dvd放荡欲情| 亚洲色图欧洲色图| av影院午夜一区| 国产亲近乱来精品视频| 国产在线一区观看| 欧美大黄免费观看| 免费成人在线视频观看| 欧美精品自拍偷拍动漫精品| 一区二区三区四区国产精品| av午夜精品一区二区三区| 国产欧美一区二区精品久导航| 国产一区免费电影| 久久久91精品国产一区二区精品 | 高潮精品一区videoshd| 日韩欧美第一区| 日韩精品一区第一页| 欧美欧美欧美欧美| 亚洲成a人片在线观看中文| 在线观看精品一区| 亚洲一区av在线| 欧美视频在线观看一区| 亚洲国产日韩精品| 欧美日韩高清一区| 日韩在线一区二区三区| 日韩一区二区电影网| 免费成人你懂的| 欧美大片国产精品| 国产自产v一区二区三区c| 精品国产99国产精品| 国产一区二区三区在线观看免费 | 久久99精品网久久| 欧美一区二区视频在线观看2022| 性欧美疯狂xxxxbbbb| 欧美精品日韩精品| 狂野欧美性猛交blacked| 久久美女艺术照精彩视频福利播放 | 成人性生交大片免费看在线播放| 中文字幕第一区综合| 91浏览器入口在线观看| 亚洲国产美国国产综合一区二区| 欧美日韩一区二区三区在线看| 亚洲 欧美综合在线网络| 日韩欧美一区二区免费| 国产精品一二三四区| 国产精品美女久久久久久2018| 99精品一区二区| 洋洋av久久久久久久一区| 欧美一区午夜视频在线观看| 免费黄网站欧美| 国产拍欧美日韩视频二区| 99精品视频在线播放观看| 香蕉成人啪国产精品视频综合网| 9191成人精品久久| 国产福利一区二区三区在线视频| 中文字幕一区二区三区乱码在线| 欧美亚洲国产bt| 久久av资源网| 国产精品家庭影院| 91麻豆精品国产91久久久资源速度| 老司机免费视频一区二区 | www.欧美日韩| 亚洲高清在线精品| 精品国产91亚洲一区二区三区婷婷| 懂色一区二区三区免费观看| 亚洲已满18点击进入久久| 91麻豆精品国产91久久久久| 国精产品一区一区三区mba视频| 国产精品久久久久久久久久久免费看 | 在线成人免费观看| 国产精品一二三区在线| 亚洲一区二区影院| 国产日韩欧美制服另类| 欧美日韩国产美| 成人高清免费在线播放| 丝袜国产日韩另类美女| 国产色产综合产在线视频| 欧美系列一区二区| 国产精品69毛片高清亚洲| 亚洲高清视频的网址| 国产色婷婷亚洲99精品小说| 欧美日本乱大交xxxxx| 国产.精品.日韩.另类.中文.在线.播放| 亚洲精品视频在线观看免费 | 丁香婷婷综合色啪| 日日摸夜夜添夜夜添亚洲女人| 久久久www成人免费毛片麻豆| 91福利在线播放| 国产99久久久国产精品免费看| 亚洲综合自拍偷拍| 国产日韩v精品一区二区| 91精品在线免费观看| 91在线观看地址| 国产一区不卡视频| 免费不卡在线观看| 亚洲激情男女视频| 国产婷婷色一区二区三区四区| 91精品国产综合久久国产大片| 色婷婷综合久久久久中文 | 亚洲天堂免费看| 26uuu国产在线精品一区二区| 欧美性极品少妇| 99久久国产综合色|国产精品| 国产一区二区精品久久99| 亚洲二区视频在线| 日韩一区中文字幕| 国产亚洲欧美日韩日本| 日韩欧美的一区二区| 欧美电影影音先锋| 91久久精品日日躁夜夜躁欧美| 国产91精品免费| 国产在线麻豆精品观看| 美腿丝袜在线亚洲一区| 亚洲电影一区二区| 亚洲一区在线视频| 亚洲欧美一区二区三区孕妇| 国产欧美精品一区aⅴ影院| 精品sm在线观看| 精品免费视频.| 亚洲精品在线电影| 欧美一区二区成人6969| 欧美一级免费观看| 91精品在线观看入口| 91精品综合久久久久久| 欧美精品在线观看播放| 欧美色综合久久| 欧洲激情一区二区| 欧美三级韩国三级日本三斤| 欧美影视一区二区三区| 在线影院国内精品| 91成人看片片| 欧美日韩激情一区二区三区| 91成人在线免费观看| 欧美亚洲一区三区| 欧美午夜不卡在线观看免费| 欧美亚州韩日在线看免费版国语版| 色网站国产精品| 欧美在线视频全部完| 欧美日本乱大交xxxxx| 在线电影国产精品| 欧美va日韩va| 国产色婷婷亚洲99精品小说| 国产免费久久精品| 国产精品久久免费看| 亚洲黄色在线视频| 亚洲午夜在线观看视频在线| 三级久久三级久久久| 国产91富婆露脸刺激对白| 99国产一区二区三精品乱码| 在线看日本不卡| 日韩一区二区影院| 久久日一线二线三线suv| 欧美激情一区二区三区蜜桃视频|