tomatokid
Newbie level 6

bpsk ber
Dear all,
I need help regarding my simulation as I am using jakes model to generate the fading coefficients. However, my result doesn't match with the one given by forumer here, who uses randn/sqrt(2) to generate the real and imaginary component of the fading process. My codes are as follows;
% Simulation of BPSK over a flat Rayleigh fading channel
function rayleigh
clear
N=1000000;
snr=0:2:24;
for m=1:size(snr,2)
efade = 0; % error counter for fading AWGN channel
egaus = 0; % error counter for AWGN channel
No = 10^(-snr(m)/10); % PSD of AWGN with signal energy normalise to 1, ie E=1
sigma = sqrt(No/2); % Standard deviation
for n=1:N
tx_signal = (-1)^round(rand); % to either get a +1 or -1 signal
% channel model
x=fading(sigma);
y=fading(sigma);
p=x+y*j; % fading power of real and imaginary component
a=abs(p); % fading amplitude
rfade = a * tx_signal + sigma*randn; % faded signal + AWGN
rgauss = tx_signal + sigma*randn; % unfaded signal + AWGN
% received signal
if (rfade>0)
estimate_fade = +1;
else
estimate_fade = -1;
end
if (rgauss>0)
estimate_gauss = +1;
else
estimate_gauss = -1;
end
% checking for error
if (estimate_fade ~= tx_signal)
efade = efade + 1;
end
if (estimate_gauss ~= tx_signal)
egaus = egaus + 1;
end
end
% calculating error probability
pe(m)=efade/N; % BER flat Rayleigh fading
peg(m)=egaus/N; % BER AWGN only
% results
fprintf('%f \t %e\n',snr(m),pe(m));
end
semilogy(snr,pe,'-')
hold on
semilogy(snr,peg,':')
legend('Rayleigh channel','AWGN channel');
ylabel('Bit Error Rate');
xlabel('Average E_b/N_0 (dB)');
title('Perfomance of BPSK over flat-Rayleigh and AWGN channels');
axis([ snr(1) snr(end) 9.5e-6 1])
grid on
% this function simulate the fading process with jakes spectrum
function z = fading(sigma)
fmax = 0.05/(2*pi);
N = 50;
y = 0;
Cn = sqrt(sigma*2/N);
phase = rand(1,N)*2*pi;
for n=1:N
fn = fmax*sin((pi*n)/(2*N));
y = y + Cn*cos(2*pi*fn*j + phase(1,n));
end %end for
z = y;
Dear all,
I need help regarding my simulation as I am using jakes model to generate the fading coefficients. However, my result doesn't match with the one given by forumer here, who uses randn/sqrt(2) to generate the real and imaginary component of the fading process. My codes are as follows;
% Simulation of BPSK over a flat Rayleigh fading channel
function rayleigh
clear
N=1000000;
snr=0:2:24;
for m=1:size(snr,2)
efade = 0; % error counter for fading AWGN channel
egaus = 0; % error counter for AWGN channel
No = 10^(-snr(m)/10); % PSD of AWGN with signal energy normalise to 1, ie E=1
sigma = sqrt(No/2); % Standard deviation
for n=1:N
tx_signal = (-1)^round(rand); % to either get a +1 or -1 signal
% channel model
x=fading(sigma);
y=fading(sigma);
p=x+y*j; % fading power of real and imaginary component
a=abs(p); % fading amplitude
rfade = a * tx_signal + sigma*randn; % faded signal + AWGN
rgauss = tx_signal + sigma*randn; % unfaded signal + AWGN
% received signal
if (rfade>0)
estimate_fade = +1;
else
estimate_fade = -1;
end
if (rgauss>0)
estimate_gauss = +1;
else
estimate_gauss = -1;
end
% checking for error
if (estimate_fade ~= tx_signal)
efade = efade + 1;
end
if (estimate_gauss ~= tx_signal)
egaus = egaus + 1;
end
end
% calculating error probability
pe(m)=efade/N; % BER flat Rayleigh fading
peg(m)=egaus/N; % BER AWGN only
% results
fprintf('%f \t %e\n',snr(m),pe(m));
end
semilogy(snr,pe,'-')
hold on
semilogy(snr,peg,':')
legend('Rayleigh channel','AWGN channel');
ylabel('Bit Error Rate');
xlabel('Average E_b/N_0 (dB)');
title('Perfomance of BPSK over flat-Rayleigh and AWGN channels');
axis([ snr(1) snr(end) 9.5e-6 1])
grid on
% this function simulate the fading process with jakes spectrum
function z = fading(sigma)
fmax = 0.05/(2*pi);
N = 50;
y = 0;
Cn = sqrt(sigma*2/N);
phase = rand(1,N)*2*pi;
for n=1:N
fn = fmax*sin((pi*n)/(2*N));
y = y + Cn*cos(2*pi*fn*j + phase(1,n));
end %end for
z = y;