Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Rayleigh Fading Channel simulation

Status
Not open for further replies.

israilsaifi

Newbie level 1
Joined
Jan 31, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
rayleigh fading simulation

how one can generate two path fading and transmiits ddata on it in matlab ?
 

gaffar

Member level 1
Joined
Jul 14, 2006
Messages
32
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,288
Location
Turkey
Activity points
1,441
rayleigh fading

You can use communications blockset in matlab. There is Rayleigh Fading Channel block in blockset and you can simulate implementing a simple simulink model.
 

tarakapraveen

Member level 5
Joined
Jan 18, 2007
Messages
83
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,288
Activity points
1,855
rayleigh fading channel

hi
You can use the Clarke's model given in the Rappaport book.
In that what they did was Rayleigh fading envelope is combination of two Gaussian Sources like as

Define
Gaussian : randn(1,100)

Rayleigh :randn(1,100)+j*randn(1,100);

if u plot absolute value of above equation in Matlab you ll get the rayleigh envelope.But in the fading environment case we are experiencing Doppler shift so we hav to design a filter with that doppler frequency and pass that Rayleigh faded signal i.e above 2nd one through that filter.

If any mistakes correct me
Regards,
Taraka
 

amihomo

Full Member level 5
Joined
Jan 9, 2007
Messages
285
Helped
66
Reputation
132
Reaction score
42
Trophy points
1,318
Location
PERSIAN Gulf
Activity points
3,092
rayleighchan

hi

you can use a 2-tap delay line to model a two path rayleigh fading channel , i.e. , if x is the signal passed through the channel , the output of the channel will be :
y(n)=a1.*x(n)+a2.*x(n-taw)

where a1 and a2 are rayleigh random variables (slow rayleigh fading envelopes in each path) and taw is the relative delay between two paths .

regards
 

bee

Full Member level 2
Joined
Nov 29, 2003
Messages
135
Helped
7
Reputation
14
Reaction score
5
Trophy points
1,298
Activity points
883
rayleigh fading channel generation

if u use this eq for the Rayleigh :randn(1,100)+j*randn(1,100);
then i think you need to divide it by sqrt(2) to make the var = 1.


correct me if am not right.
 

maomun

Junior Member level 3
Joined
Jan 9, 2007
Messages
25
Helped
8
Reputation
16
Reaction score
6
Trophy points
1,283
Activity points
1,461
rayleigh fading simulations

hello

if u have matlab version 7(or higher) , then type this in command window.


"help rayleighchan"


sweet :D
 

waqasbukhari

Newbie level 4
Joined
Feb 4, 2007
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,346
fading channel simulation

i would try to elaborate the whole concept in mathematical language.
rayleigh fading channel consists of two random variables
1 - channel impulse response of each multipath component and it can be approximated by a gaussian distribution.
2 - impact of scattering environment on each componen.

both of these have gaussian approximations with zero mean and finite variance and central limit theorem permits us to model them as gaussian approximation.

now, the whole channel response can be a rayleigh approximations and its equivalent equation can be something like


received signal = sum [(fading parameter) *(input signal)]

now my credibility:
i am UG student doing my FYP in improving the transmission strategies by overcoming the fading effects.

bye

Added after 6 minutes:

one more thing to elaborate what Mr. Taraka suggested.
he is all right if the generated random numbers are between -1 to 1 so that each one of them is approximated by gaussian distribution and both the generated random variables are qualified to be independent and identically distributed ie, their mutual cross correlation must be zero and their distributions are gaussian. then we can compute the magnitude of the vector which would be then come out to be rayleigh distributed.
bye
 

vuday455

Newbie level 5
Joined
Sep 3, 2007
Messages
10
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,401
fading channel generation

could u pls anyone explain me how can i use the 'rayleighchan' function in loop for simulation of ofdm system..

i passed the say 100 symbols through this rayleighchan function and i added indivually awgn ...then after demodulation i ploted the ber curve.

i am appending my code..is my code is correct..pls correct it if any wrong..

and also pls let me know abt how can i modify the code for working in case of varying dopler frequency..

<-----------------------------**********************------------------------------->

% ofdm system design ...

% BW = input('enter the channel bandwidth :');
% Nused = input('enter the number of subcarriers :');
% n_factor = input('enter the sampling factor :');
% G = input('enter the ration of CP time to Useful time :');
clear all
close all
clc
BW = 1.75e6;
Nused = 200;
n_factor = 8/7;
G = 1/4;

[Nfft,Fs,delta_f,Tb,Tg,Ts,sampling_time] = derived_parameters(BW,Nused,n_factor,G);

% Nfft-->fft size , Fs-->sampling frequency , delta_f-->suhcarrier spacing
% Tb--> useful symbol time, Tg-->guard/CP time, Ts-->OFDM Symbol
% time (Tb+Tg)
N_prefix = Nfft*G;
N_data = 192;
N_pilot = 8;
SNR = 0:2:20; % snr in db

M = 4; % order of modulation
n = log2(M); % no. of bits per symbol

% chan = rayleighchan(sampling_time,200);
% chan.resetbeforefiltering = 0;
ber_final = zeros(1,length(SNR));
no_of_symbols = 100;
%chan.resetbeforefiltering =0;
for i = 1:length(SNR)
i
test_1 = [];
test_2 = [];
errors_new = 0;
for j=1:no_of_symbols
x_user = floor(M*rand(N_data,1));
test_1 = [test_1,x_user.'];
%x_user = floor(M*rand(Nfft,1));
X_mod_out = qammod(x_user,M).';
% subcarrier_out = subcarrier_mapping(X_mod_out.',Nfft);
% subcarrier mapping
subcarrier_out = zeros(Nfft,1);
subcarrier_out([29:40,42:65,67:90,92:115,117:128,130:141,143:166,168:191,193:216,218:229]) = X_mod_out;
% % processing information for getting timedomain waveform
% subcarrier_out = X_mod_out;
x_out = tx_sub_part(subcarrier_out,Nfft);
x_ofdm_symbol = [x_out(Nfft-N_prefix+1:end),x_out].';

% channel generation and passing the signal through fading channel

%chan = rayleighchan(sampling_time,2,[0,1.5e-5,3.2e-5],[0,-3,-3]);

%chan.StoreHistory = 0;
chan = rayleighchan(sampling_time,100);
%chan = rayleighchan(sampling_time,10,[0,Tg/4],[0,-20]);
% chan.resetbeforefiltering = 0;
%chan = ricianchan(sampling_time,4,[0,Tg/10],[0,-9],10);
y_fading = filter(chan,x_ofdm_symbol);

gain_c = chan.pathgains;
Gain_c = fft(gain_c,Nfft).';


% pasing signal through awgn channel
y_awgn = awgn(y_fading,SNR(i),'measured');

% removing the cycling prefix part
% it is also known as synchronisation part
% here perfect synchronisation is assued

y_received = y_awgn(N_prefix+1:end);

% one tap equalizer is implimented below

eq_out = y_received./Gain_c;

r_out = rx_sub_part(eq_out.',Nfft);

%demap_out = subcarrier_demap(r_out);
% getting information symbols by subcarrier demapping
demap_out = r_out([29:40,42:65,67:90,92:115,117:128,130:141,143:166,168:191,193:216,218:229]);

%demap_out = r_out;

% demodulation of the signal
x_cap = qamdemod(demap_out,M);
test_2 = [test_2,x_cap.'];

%[ no_of_errors,BER ] = biterr(x_cap,x_user);

%errors_new = errors_new + no_of_errors;
end
[ no_of_errors,BER(i) ] = biterr(test_1,test_2);
%ber_final(i) = errors_new/(N_data*no_of_symbols);
end

semilogy(SNR,BER);
xlabel('SNR in dB');
ylabel('BER Values');
title('SNR Vs BER plot');


% this programme is for subpart of the transmitter...
% input--> Xin : out put of modulator
% Nfft : FFT size
% output--> x_out : time domain version ( 1xNfft )

function [x_out] = tx_sub_part(Xin,Nfft)

[x_out] = ifft(Xin.',Nfft);
end


% this function is for implimenting the subpart of the receiver
% input--> r_in : output of the channel
% Nfft : FFT size
% output--> R_out : frequency domain version of the received signal
% (1xNfft)

function [R_out] = rx_sub_part(r_in,Nfft)
[R_out] = fft(r_in.',Nfft);
end

<---------------------------********************---------------------------------->

thanx regards..
uday
 
  • Like
Reactions: amyeka

    amyeka

    Points: 2
    Helpful Answer Positive Rating

srithesaint

Newbie level 1
Joined
Mar 30, 2008
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
rayleigh fading simulation

to any one still active in this topic....

can u explain me how the rayleigh fading simulation in Rappaport book sec [5.72] working. please explain me how the method of rayleigh fading simulation working. i don't understand the part saying generate complex gaussian random variables for each N/2 positive frequency. why do we need to do N/2?

how to assign these noise to frequancy components?

i have the max doppler freq 200Hz, sampling period 2 seconds, number of samples 10001

please give example of coding for this methods....i need it urgently thank you
 

patriot100

Newbie level 1
Joined
Apr 20, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,284
tap delay line

Hi vuday
could you find any explanation of your code? if so, can you explain it us, too?
 

Sherra

Member level 3
Joined
Dec 23, 2010
Messages
63
Helped
7
Reputation
14
Reaction score
7
Trophy points
1,288
Activity points
1,731
Re: fading channel generation

Hi Vuday!!

Hi all,
is anyone still active in this post???

Find it intersting, as i am working on multipath channels in OFDM, i was just wondering how i could change this code to include delays..could ANYONE PLEASE just give me directions..?
Also, WHEN I HAVE TO INCLUDE DELAYS, during the equalization part i think i will have to FFT not only the gain but the channel object (chan) and divide it to the noisy data.. am i right?

Please any direction advice ANYONE

Thanks in advance!


could u pls anyone explain me how can i use the 'rayleighchan' function in loop for simulation of ofdm system..

i passed the say 100 symbols through this rayleighchan function and i added indivually awgn ...then after demodulation i ploted the ber curve.

i am appending my code..is my code is correct..pls correct it if any wrong..

and also pls let me know abt how can i modify the code for working in case of varying dopler frequency..

<-----------------------------**********************------------------------------->

% ofdm system design ...

% BW = input('enter the channel bandwidth :');
% Nused = input('enter the number of subcarriers :');
% n_factor = input('enter the sampling factor :');
% G = input('enter the ration of CP time to Useful time :');
clear all
close all
clc
BW = 1.75e6;
Nused = 200;
n_factor = 8/7;
G = 1/4;

[Nfft,Fs,delta_f,Tb,Tg,Ts,sampling_time] = derived_parameters(BW,Nused,n_factor,G);

% Nfft-->fft size , Fs-->sampling frequency , delta_f-->suhcarrier spacing
% Tb--> useful symbol time, Tg-->guard/CP time, Ts-->OFDM Symbol
% time (Tb+Tg)
N_prefix = Nfft*G;
N_data = 192;
N_pilot = 8;
SNR = 0:2:20; % snr in db

M = 4; % order of modulation
n = log2(M); % no. of bits per symbol

% chan = rayleighchan(sampling_time,200);
% chan.resetbeforefiltering = 0;
ber_final = zeros(1,length(SNR));
no_of_symbols = 100;
%chan.resetbeforefiltering =0;
for i = 1:length(SNR)
i
test_1 = [];
test_2 = [];
errors_new = 0;
for j=1:no_of_symbols
x_user = floor(M*rand(N_data,1));
test_1 = [test_1,x_user.'];
%x_user = floor(M*rand(Nfft,1));
X_mod_out = qammod(x_user,M).';
% subcarrier_out = subcarrier_mapping(X_mod_out.',Nfft);
% subcarrier mapping
subcarrier_out = zeros(Nfft,1);
subcarrier_out([29:40,42:65,67:90,92:115,117:128,130:141,143:166,168:191,193:216,218:229]) = X_mod_out;
% % processing information for getting timedomain waveform
% subcarrier_out = X_mod_out;
x_out = tx_sub_part(subcarrier_out,Nfft);
x_ofdm_symbol = [x_out(Nfft-N_prefix+1:end),x_out].';

% channel generation and passing the signal through fading channel

%chan = rayleighchan(sampling_time,2,[0,1.5e-5,3.2e-5],[0,-3,-3]);

%chan.StoreHistory = 0;
chan = rayleighchan(sampling_time,100);
%chan = rayleighchan(sampling_time,10,[0,Tg/4],[0,-20]);
% chan.resetbeforefiltering = 0;
%chan = ricianchan(sampling_time,4,[0,Tg/10],[0,-9],10);
y_fading = filter(chan,x_ofdm_symbol);

gain_c = chan.pathgains;
Gain_c = fft(gain_c,Nfft).';


% pasing signal through awgn channel
y_awgn = awgn(y_fading,SNR(i),'measured');

% removing the cycling prefix part
% it is also known as synchronisation part
% here perfect synchronisation is assued

y_received = y_awgn(N_prefix+1:end);

% one tap equalizer is implimented below

eq_out = y_received./Gain_c;

r_out = rx_sub_part(eq_out.',Nfft);

%demap_out = subcarrier_demap(r_out);
% getting information symbols by subcarrier demapping
demap_out = r_out([29:40,42:65,67:90,92:115,117:128,130:141,143:166,168:191,193:216,218:229]);

%demap_out = r_out;

% demodulation of the signal
x_cap = qamdemod(demap_out,M);
test_2 = [test_2,x_cap.'];

%[ no_of_errors,BER ] = biterr(x_cap,x_user);

%errors_new = errors_new + no_of_errors;
end
[ no_of_errors,BER(i) ] = biterr(test_1,test_2);
%ber_final(i) = errors_new/(N_data*no_of_symbols);
end

semilogy(SNR,BER);
xlabel('SNR in dB');
ylabel('BER Values');
title('SNR Vs BER plot');


% this programme is for subpart of the transmitter...
% input--> Xin : out put of modulator
% Nfft : FFT size
% output--> x_out : time domain version ( 1xNfft )

function [x_out] = tx_sub_part(Xin,Nfft)

[x_out] = ifft(Xin.',Nfft);
end


% this function is for implimenting the subpart of the receiver
% input--> r_in : output of the channel
% Nfft : FFT size
% output--> R_out : frequency domain version of the received signal
% (1xNfft)

function [R_out] = rx_sub_part(r_in,Nfft)
[R_out] = fft(r_in.',Nfft);
end

<---------------------------********************---------------------------------->

thanx regards..
uday


---------- Post added at 23:38 ---------- Previous post was at 22:55 ----------

Hi again, was trying to simulate but the function "derived_parameter" is missing..., where is the function "derived_parameter" what does it do exactly?
 

Ahmed Alaa

Full Member level 5
Joined
Jul 22, 2009
Messages
317
Helped
61
Reputation
136
Reaction score
44
Trophy points
1,318
Location
Egypt
Activity points
2,963
Check Rayleighchan function in MATLAB. You can select the number of paths, path gains and delays.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top