資源簡介
AmplifyandForward.m
代碼片段和文件信息
%%?This?programe?provides?SER?analysis?of?amplify?and?forward?cooperative?protocol?using?QPSK?modulation%%%
%%?Results?are?compared?with?theoratical?results?for?QPSK?modulation?with?AWGN?and?Rayleigh?fading?channels?%%%
clear?all
clc
N=?10^6;?%number?of?symbols
Pt=1;%?Total?Tranmited?Power
Pb=Pt/2;%?Transmitted?power?of?source
Pr=Pt/2;?%?Transmitted?power?of?Relay
snr_db=[0:40];%?SNR?in?dB
data_BS1?=?((2*(rand(1N)>0.5)-1)?+?j*(2*(rand(1N)>0.5)-1))%%?Data?generation
data=zeros(1N);?%?Received?data?matrix
%%?Channel?gains
????????channel_BS1_RS1=(1/sqrt(2)).*[randn(1N)+j*randn(1N)];%?Channel?coefficients?for?Soure-Relay?link
????????a11=sum((abs(channel_BS1_RS1)))/N;?%Average?channel?gain?for?Soure-Relay?link?Channel
????????????????
????????channel_RS1_MS1=(1/sqrt(2)).*[randn(1N)+j*randn(1N)];%?Channel?coefficients?for?Relay-Desination?link
????????b11=sum((abs(channel_RS1_MS1)))/N;?%Average?channel?gain?for?Relay-Desination?link?Channel
????????????????
????????channel_BS1_MS1=(1/sqrt(2))*[randn(1N)+j*randn(1N)];%?Channel?coefficients?for?Soure-Desination?Direct?link
????????c11=sum((abs(channel_BS1_MS1)))/N;?%Average?channel?gain?for?Soure-Desination?link?Channel
?%%?AWGN?????
????????nbr=(1/sqrt(2)).*(randn(1N)+j*randn(1N));%AWGN?for?at?Relay?for?Soure-Relay?link
????????nrm=(1/sqrt(2)).*(randn(1N)+j*randn(1N));%AWGN?for?at?Desination??for?Relay-Desination?link
????????nbm=(1/sqrt(2)).*(randn(1N)+j*randn(1N));%AWGN?for?at?Desination??for?source-Desination?link
????????
for???????i=1:length(snr_db)
????????????????snr_linear(i)=10.^(snr_db(i)/10);???%?Linear?value?of?SNR???????????????????????????
????????????????No(i)=Pt./snr_linear(i);????????????%?Noise?power
?????????????????
???%%?AMPLIFICATION?FACTOR
???????????????Beta1=sqrt(Pr./(a11^2.*Pb+No(i)));
??????????????????????????????
???%%?RECEIVED?DATA?AT?RELAY?FROM?BS?????????
???????????????data_BS1_RS1=sqrt(Pb/2).*data_BS1.*channel_BS1_RS1+sqrt(No(i))*nbr;
????????????????????????????
???%%?RECEIVED?DATA?AT?MS?FROM?RS?
評論
共有 條評論