FSK mod and demod with fading and noise

1 次查看(过去 30 天)
Salma
Salma 2011-4-28
I'm trying to design FSK modulator and demodulator with noise and flat fading but the graph of snr vs ber with fading in wrong, any idea how to fix it??
clear all;clf;clc;close all;
M = 2;
k = log2(M);
EbNo = 5;
Fs = 16;
nsamp = 17;
freqsep = 8;
n=10000;
msg = randint(n,1,M);
txsig = fskmod(msg,M,freqsep,nsamp,Fs);
ab=abs(txsig);
ps=(sum(ab.^2))/n;
for snr=1:30
pn=10.^(-0.1.*snr).*ps;
noise= sqrt(pn)*randn(1,n*nsamp);
G1=randn(1,n); %generating fading coefficients
G2=randn(1,n);
v= sqrt(power(G1,2)+ power(G2,2));
A=v(2);
theta=2*pi*rand;
alph=A*exp(j*theta);
msg_rx = alph*txsig + noise'; % txsig is 1700x1 and noise is 1x1700, so need transpose
msg_rxx=msg_rx.*(1/A)*conj(alph);
msg_rrx = fskdemod(msg_rxx,M,freqsep,nsamp,Fs);
[num,BER] = biterr(msg,msg_rrx); % Bit error rate
w(snr)=BER;
end
d=[1:30];
figure
semilogy(d,w)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 PHY Components 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by