Continue to Site

# HELP: BER for a BPSK signal going through a fading channel

Status
Not open for further replies.

#### 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)
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
p=x+y*j; % fading power of real and imaginary component

rfade = a * tx_signal + sigma*randn; % faded signal + AWGN
rgauss = tx_signal + sigma*randn; % unfaded signal + AWGN

else
end
if (rgauss>0)
estimate_gauss = +1;
else
estimate_gauss = -1;
end

% checking for error
end
if (estimate_gauss ~= tx_signal)
egaus = egaus + 1;
end
end

% calculating error probability
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

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;

anybody care to help?

Re: HELP: BER for a BPSK signal going through a fading chann

Hi
I think you are using jakes model as a form of rayleigh fading .
the folowing code produces BER of BPSK in rayleigh fading that matches accurately to the theoretical BER of BPSK in fading channel.
It also uses monte carlo simulation to have more accurate response.

clc;
clf;
clear all;
for snr=1:50
snrnum=10^(snr/10);
end
snr=1:50;
grid on;
datanrzpolar=randsrc(1,1000);
for snr=1:50
signal_amp=sqrt(10^(snr/10))*datanrzpolar;
for mcr=1:100
noise=randn(1,1000);
noise1=randn(1,1000);
cnoise=complex(noise,noise1);
cnoise=cnoise/(sqrt(var(cnoise)));
p_f=2*pi*randn(1,1000);
x1=randn(1,1000);
x2=randn(1,1000);
x1=x1/(sqrt(var(x1)));
x2=x2/(sqrt(var(x2)));
for i=1:1000
alpha(i)=sqrt(x1(i)^2+x2(i)^2);
end
chi=alpha.^2;
chi_mean=mean(chi);
alpha_normalised=alpha./sqrt(chi_mean);
for i=1:1000
h(i)=alpha_normalised(i)*complex(cos(p_f(i)),-sin(p_f(i)));
r(i)=h(i)*signal_amp(i)+cnoise(i);
end
for i=1:1000
mrc(i)=r(i)*conj(h(i));
end;
for i=1:1000
if(real(mrc(i))>=0)
decision(i)=1;
else
decision(i)=-1;
end
end
hamm=0;
for i=1:1000
if(decision(i)~=datanrzpolar(i))
hamm=hamm+1;
end;
end
pe(mcr)=hamm/1000;
end
pepsk(snr)=mean(pe);
end
snr=1:50;
hold on;
semilogy(snr,pepsk,'r*');
grid on;

i hope its useful for you. The same can be used for simualtion of BER of BFSK in fading channel.

**broken link removed** u get here wat u require

Last edited by a moderator:

Re: HELP: BER for a BPSK signal going through a fading chann

yella said:
www.dsplog.com...u get here wat u require

I second that

Status
Not open for further replies.