+ Post New Thread
Results 1 to 16 of 16

22nd May 2006, 22:38 #1
 Join Date
 Feb 2005
 Posts
 19
 Helped
 0 / 0
 Points
 1,493
 Level
 8
rayleigh fading matlab
Anyone here know how to generate rayleigh distribution(rayleigh fading) in Matlab?For Gaussian, it is very simple as randn(x).How about for very basic Rayleigh?I mean without cosider doppler frequency and etc.

22nd May 2006, 22:38

23rd May 2006, 03:37 #2
 Join Date
 May 2006
 Posts
 33
 Helped
 4 / 4
 Points
 1,297
 Level
 8
rayleigh distribution matlab
If you do not care about doppler.That is if you do not do channel estimation, and other effects.
Rayleigh can be generated by
R=randn(N,1)+sqrt(1)*randn(N,1);
and the envelope is distruibuted according to rayleigh as
r=abs(R)

28th June 2006, 16:56 #3
 Join Date
 Jan 2003
 Posts
 76
 Helped
 1 / 1
 Points
 2,506
 Level
 11
rayleigh matlab
Code:% Program to simulate Rayleigh fading using a pth order autoregressive model AR(p) according to % Baddour's work: "Autoregressive modeling for fading channel simulation", IEEE Transaction on Wireless Communications, July 2005. function [chann]=Rayleigh_fading(P,M,fm,fs,epselonn) % P: AR model order % M: number of samples % fd: maximum doppler frequency in Hz % fs: Symbol frequency in ksps % epselonn: added bias, depends on the Doppler rate, see the paper "Autoregressive modeling for fading channel simulation". % usage: Rayleigh_fading(100,10000,150,3,0.00000001) % for p=1:P+1 vector_corr(p)=besselj(0,2*pi*fm*(p1)/(fs*1000)); % Bessel autocorrelation function according to Jakes' model end auto_correaltion_matrix=toeplitz(vector_corr(1:P))+eye(P)*epselonn; % adding a small bias, epselonn, to the autocorrelation matrix to overcome the ill conditioning of YuleWalker equations AR_parameters=inv(auto_correaltion_matrix)*vector_corr(2:P+1)'; % Solving the YuleWalker equations to obtain the model parameters segma_u=auto_correaltion_matrix(1,1)+vector_corr(2:P+1)*AR_parameters; KKK=2000; h=filter(1,[1 AR_parameters.'],wgn(M+KKK,1,10*log10(segma_u),'complex')); % Use the function Filter to generate the channel coefficients chann=h(KKK+1:end,:); % Ignore the first KKK samples %
:D"Info will make us free.."

4th July 2006, 08:46 #4
 Join Date
 Jun 2006
 Posts
 16
 Helped
 5 / 5
 Points
 1,514
 Level
 8
rayleigh channel matlab
SEE THIS

10th July 2006, 20:54 #5
 Join Date
 Jul 2006
 Posts
 5
 Helped
 0 / 0
 Points
 1,168
 Level
 7
rayleigh fading channel matlab
Originally Posted by malaylah

23rd August 2006, 07:00 #6
 Join Date
 Aug 2005
 Location
 Ukraine
 Posts
 71
 Helped
 4 / 4
 Points
 1,669
 Level
 9
matlab rayleigh
Originally Posted by janath
how to take into account when modelling the flat slow fading
the speed of fading, the delay. Please could anyone post the matlab code
taking into account my questions?

23rd August 2006, 15:46 #7
 Join Date
 Aug 2006
 Posts
 2
 Helped
 0 / 0
 Points
 1,156
 Level
 7
jakes model matlab
Originally Posted by lincolndsp

23rd August 2006, 15:46

24th August 2006, 06:37 #8
 Join Date
 Aug 2005
 Location
 Ukraine
 Posts
 71
 Helped
 4 / 4
 Points
 1,669
 Level
 9
matlab rayleigh distribution
what is the range of ratios of fm and fs for
slow flat fading
and how to apply channel coefficients obtained using
the code provided by System.out to get the resulting
fading signal. I mean I have the input signal s and
channel coefficients, how do i get the resulting fading
signal, say, r

25th August 2006, 01:39 #9
 Join Date
 Aug 2006
 Posts
 3
 Helped
 0 / 0
 Points
 1,616
 Level
 9
rayleigh fading channel matlab code
another article about raleigh fading

1st February 2007, 12:31 #10
 Join Date
 Feb 2007
 Posts
 8
 Helped
 0 / 0
 Points
 1,094
 Level
 7
fading channel matlab
i want to know about simple fast rayleigh fading channel program in matlab..is anyone knows about it? i just want to make it as my reference, so that i can learn fast rayleigh fading channel from that program...
thak you

5th February 2007, 00:24 #11
 Join Date
 Feb 2007
 Posts
 5
 Helped
 0 / 0
 Points
 1,061
 Level
 7
matlab rayleigh fading
this is how i used it in my UG project when dealing with a case of flat fading .
%function flatfading
clear;
N =100; %Enter the number of random scaterers
M =1000 %Enter the no of realizations
A = 1 %Enter the value of A
fc =1000; %carrier frequency
Fs=4000; %sampling frequency greater than Nyquist rate
w = 2 * pi * fc ;
t = [0:(1/Fs):(M1)*(1/Fs)];
L=length(t);
theta = (rand(N,1) * 2 * pi)  pi;
Ak = (rand(N,1) * 2)  1;
X = zeros(1,L) ;
for m = 1:N
X=X+Ak(m)*cos(w.*t+theta(m));
end
% Analyzing that X(t) is a narrowband spectral process
Y = fft(X) ;
Y = fftshift(Y) ;
plot(abs(Y)) ;
title( 'Magnitude of fft of a single realisation of X(t)') ;
xlabel( 'Frequency' ) ;
ylabel( 'Magnitude' ) ;
pause
%Calculating XI and XQ
Ak = (rand(N,M) * 2 )  1;
theta = (rand(N,M) * 2 * pi)  pi;
XI = zeros(1,M ) ;
XQ = zeros(1,M ) ;
for i=1:N
XI = XI+(Ak(i,:).*cos(theta(i,:)));
XQ = XQ+(Ak(i,:).*sin(theta(i,:)));
end
%Calculating the central moments and beta values for in and quadrature phase
U2_inphase = moment(XI,2);
U3_inphase = moment(XI,3);
U4_inphase = moment(XI,4);
B1_inphase = (U3_inphase)^2/(U2_inphase)^3
B2_inphase = (U4_inphase)/(U2_inphase)^2
U2_quad = moment (XQ,2);
U3_quad = moment (XQ,3);
U4_quad = moment (XQ,4);
B1_quad = (U3_quad)^2/(U2_quad)^3
B2_quad = (U4_quad)/(U2_quad)^2
%Calculating the envelope r from the M realisations of XI and XQ
r = sqrt(XI .^ 2 + XQ .^ 2);
phi = atan(XQ ./ XI);
R=hist(r,100);
index = 1:100 ;
R_index = (index/length(index)*ceil( max(r)));
stem(R_index,R)
title( 'Histogram of distribution of the Envelope R' ) ;
xlabel('R') ;
ylabel('Frequency of R' ) ;
pause
% including line of sight component
for a = 0:5
XL = a*cos(2*pi*fc*t);
XI_2 = XI + XL;
r = sqrt(XI_2 .^ 2 + XQ .^ 2);
R = hist(r,100);
index = 1:100 ;
R_index = (index/length(index)*ceil( max(r)));
subplot( 2, 3,(a +1));
plot(R_index,R)
end

5th February 2007, 00:24

5th February 2007, 09:27 #12
 Join Date
 Nov 2003
 Posts
 135
 Helped
 7 / 7
 Points
 2,663
 Level
 12
rayleigh channel matlab code
this is the way i used rayleigh flat fading.....
divide the data in small frames and then convolve it with the h, where h = (randn(1) + j*randn(1))/sqrt(2);
the value of h will be diff for each frame.
It a flat fadding in the sence that the value of channel remains constant over the time(here frame)
correct me if i am wrong.

6th February 2007, 00:38 #13
 Join Date
 Jun 2001
 Posts
 184
 Helped
 7 / 7
 Points
 2,890
 Level
 12
rayleigh fading in matlab
To generate a Rayleigh fading channel model, you first generate real and image part of the independent Gaussian process, then you need design a filter to have the spretrum similar to Jakes model, i.e, to have the Bessel function as the autocorrelation. Passing through the I, Q Gaussian process to this filter, you oculd get the Rayleigh fadung model.

24th December 2008, 01:27 #14
 Join Date
 Dec 2007
 Posts
 4
 Helped
 0 / 0
 Points
 919
 Level
 6
rayleigh channel in matlab
The cdf of rayleigh distribution is
F(r) = 1  exp(r^2/2sigma^2)
r = sqrt(2sigma^2 * ln(1F(r))
In the matlab code, i set 2sigma^2 = 1 so
r = sqrt(log(rand(1,N)));
receive_signal = transmit_signal.*r + awgn;
Not sure whether it is correct?

17th November 2010, 17:57 #15
 Join Date
 Feb 2010
 Location
 USA
 Posts
 3
 Helped
 0 / 0
 Points
 516
 Level
 4
Re: rayleigh channel in matlab
can anyone explain how to send an input signal through the calculated channel coefficients as described by MATLAB Central  File detail  Rayleigh Fading Channel Simulation
this code gives the channel coefficients, how to use these to send a signal of my interest. Thank you.

29th January 2011, 12:19 #16
 Join Date
 Jan 2011
 Posts
 1
 Helped
 0 / 0
 Points
 340
 Level
 3
Re: rayleigh channel in matlab
Hi,
I tried to implement Rayleigh channel with the same Principe, but the system give me this error:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> canal16 at 13
demodulator_output=Rl*modulator_output+sigma*(rand n(1,T)+j*randn(1,T));
Error in ==> test5 at 125
demodulator_output=canal16(demodulator_output);

this is the block programmed
function demodulator_output=canal16(modulator_output);
global sigma T
comp1=(1/sqrt(2))*randn(1,T);
comp2=(1/sqrt(2))*randn(1,T);
% variable aleatoire rayleigh
%RL=sqrt(square(comp1)+square(comp2));
Rl=sqrt((comp1.^2+comp2.^2));
demodulator_output=Rl*modulator_output+sigma*(rand n(1,T)+j*randn(1,T));
can you please tell me how to define the inner matrix dimension?
+ Post New Thread
Please login