Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function result = Rayleigh_Ch(Corr_param,N, n_samples)
%Corr_param=Correlation parameter desired between 0 and 1
%N=Number of correlated variables (ex: in a 4×4 channel matrix
%N=4×4=16)
n_t=sqrt(N);
n_r=sqrt(N);
Wrayl=zeros(n_t,n_r,n_samples);
RaylValue=zeros(n_t,n_r);
rayl_param=sqrt(2/pi);
%Matrix Initialization
V_Complex=zeros(N,n_samples);
W=zeros(N,n_samples);
%%%%
%% STEP 1: NORMALIZE THIS MATRIX TO CREATE THE NORMALIZED COVARIANCE MATRIX
%% OF RAYLEIGH SAMPLES
%%%%
Kg=Corr_param*ones(N,N);
for pos_diag=1:1:N
Kr(pos_diag,pos_diag)=1;
end
%%%%
%% STEP 2: GENERATE N UNCORRELATED COMPLEX GAUSSIAN SAMPLES IN VECTOR V,
%% THEN DETERMINE THE COLORING MATRIX L AND GENERATE THE COMPLEX GAUSSIAN
%% SAMPLES USIN W=L*V
%%%%
%obtaining the coloring matrix
[L,P,U]=lu(Kg);
%GENERATE N UNCORRELATED COMPLEX GAUSSIAN SAMPLES IN VECTOR V
for sample=1:1:n_samples
%generate correlated complex Gaussian samples using W=L*V
V_Complex(:,sample)=sqrt(0.5)*randn(N,1)+1i*sqrt(0.5)*randn(N,1);
W(:,sample)=L*V_Complex(:,sample);
end
Wgauss=reshape(W,1,N*n_samples);
%%%%
%% STEP 3: Create the desired Rayleigh envelopes
%%%%
Wrayl=abs(real(Wgauss))+1j*(imag(Wgauss));
Wrayl=reshape(Wrayl,4,4,n_samples); %every sample is a rayleigh fadding channel matrix
result=Wrayl;
end %end of the function