how can i write a program that transmits a signal through a AWGN channel .. showing the effect of the noise?? how can i compute bit error rate and signal to noise ration and then plot them togother using matlab
Ältere Kommentare anzeigen
l=10^4; // total number of transmitted bits (no. of si)
errorcounter=0;
snr=[1:15]; // range of signal to noise ratio
nni=randn(l); // the noise before multiplying it by std (standard deviation)
si=[+1 +1 -1 -1 -1 +1 -1 +1]; // my signal (is there a way to create such array without writting the whole elements like i did?)
for i=1:15
stdn=sqrt(10^(-snr/10))
ni=nni*stdn; // this is the noise that will affect the signal si
ri=ni+si; // my output
if ri>0
sdi=1; //my new array element the final result
elseif ri<=0
sdi=-1;
elseif sdi ~= si then errorcounter=errorcounter+1 // error occured
end
end
ber=errorcounter/l;
end
plot(snr,ber)
i tried to run this prog on matlab and there were lots of errors .. is there an alternate prog .. thanx alot
8 Kommentare
Rick Rosson
am 20 Dez. 2012
Please format your code. Please add comments to the code so we can understand it. Please ask a specific question.
Walter Roberson
am 20 Dez. 2012
What is the reason you think the program is not working properly?
mary
am 20 Dez. 2012
Walter Roberson
am 20 Dez. 2012
What errors do you see? Or do you mean that the errorcounter goes much higher than you expect?
Please do not use // comments on MATLAB code: it prevents people from copying and pasting your code to test it themselves.
mary
am 20 Dez. 2012
mary
am 20 Dez. 2012
mary
am 20 Dez. 2012
Akzeptierte Antwort
Weitere Antworten (1)
Rick Rosson
am 21 Dez. 2012
0 Stimmen
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!