fsk modulator and demodulator
Ältere Kommentare anzeigen
i have this code and although i added noise to it the bit error rate is still zero.. any clue?!!
%%%%%%%%%%%%%fsk mod and demod%%%%%%%%%%%%%%%%%%%%
M = 2;
k = log2(M);
EbNo = 5;
Fs = 16;
nsamp = 17;
freqsep = 8;
n=100;
msg = randint(n,1,M); % Random signal
txsig = fskmod(msg,M,freqsep,nsamp,Fs); % Modulate.
ab=abs(txsig);
ps=(sum(ab.^2))/n;
snr=30;
pn=10.^(-0.1.*snr).*ps;
noise= sqrt(pn)*randn(1,n);
G1=randn(1,n); %generation of Gaussian noise
G2=randn(1,n);
v= sqrt(power(G1,2)+ power(G2,2));
A=v(2);
theta=2*pi*rand;
msg_rx = A*exp(j*theta)*txsig + noise(3); %flat fading
msg_rrx = fskdemod(msg_rx,M,freqsep,nsamp,Fs); % Demodulate
[num,BER] = biterr(msg,msg_rrx) % Bit error rate
BER_theory = berawgn(EbNo,'fsk',M,'noncoherent') % Theoretical BER
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 21 Apr. 2011
You calculate v=sqrt(G1.^2+G2.^2) where G1 and G2 are 1 x n. You then take v(2) and throw away the rest of v. What is the point of doing all of that, when you could just do
A = sqrt(randn^2+randn^2);
This hints that you are doing something wrong. As does the fact that you use only noise(3) when noise is 1 x n .
You need to check out the magnitude of noise(3) and compare it to the magnitude of A*exp(j*theta)*txsig -- if noise(3) is very small then it would be as if you had not added the noise, merely phase-shifted the signal.
4 Kommentare
Salma
am 21 Apr. 2011
Walter Roberson
am 21 Apr. 2011
It doesn't matter what noise(17) is, as you only use noise(3)
Salma
am 21 Apr. 2011
Salma
am 29 Apr. 2011
Kategorien
Mehr zu FSK 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!