0% found this document useful (0 votes)
64 views3 pages

WCT Assignment: Solution - Coding Software-MATLAB Code - WCT40kmph - MLX

The document describes a MATLAB program to generate a Rayleigh fading channel using the sum of sinusoids method. The program takes Doppler frequency as an input and plots the channel amplitude variations for vehicle speeds of 40 kmph and 100 kmph using a 2 GHz carrier frequency. It implements the Clarke's model to generate Rayleigh fading samples based on the number of multi-paths and Doppler shifts for different velocities.

Uploaded by

Aayush Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views3 pages

WCT Assignment: Solution - Coding Software-MATLAB Code - WCT40kmph - MLX

The document describes a MATLAB program to generate a Rayleigh fading channel using the sum of sinusoids method. The program takes Doppler frequency as an input and plots the channel amplitude variations for vehicle speeds of 40 kmph and 100 kmph using a 2 GHz carrier frequency. It implements the Clarke's model to generate Rayleigh fading samples based on the number of multi-paths and Doppler shifts for different velocities.

Uploaded by

Aayush Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

WCT Assignment

1. Write a program to generate a single path Rayleigh fading channel using the
sum of sinusoids method. It should incorporate varying Doppler frequencies
(In fact, it should be an input). For 2 GHz carrier frequency, plot channel
amplitude variations for vehicle speeds of 40 kmph and 100 kmph.

Solution –
Coding Software- MATLAB
Code- WCT40kmph.mlx
clc;clear;

%INPUTS
fc=2*10^9; % Carrier Frequency(Hz)
v=40*10/36; % Velocity(m/s)
c=3*10^8; % Speed of Light (m/s)
fd=v*fc/c; % Maximum Doppler Shift(Hz)
M=45; %Number of Multi-paths
N=10^4; %Number of Samples to Generate
Ts=.0001; % Sampling Period(Seconds)
%INPUTS

h=rayleighFading(M,N,fd,Ts);
figure;
subplot(2,1,1);
plot([0:N-1]*Ts,10*log10(abs(h)));
title('Amplitude Variations of Rayleigh Fading channel of 40 kmph speed');
xlabel('Time(seconds)');ylabel('Signal Level');

function [h]=rayleighFading(M,N,fd,Ts)
% function to generate Rayleigh Fading samples based on Clarke's model
% M = Number of Multi-paths in the channel
% N = Number of samples to generate
% fd = Maximum Doppler frequency
% Ts = Sampling period
a=0;
b=2*pi;
alpha=a+(b-a)*rand(1,M); %uniformly distributed from 0 to 2 pi
beta=a+(b-a)*rand(1,M); %uniformly distributed from 0 to 2 pi
theta=a+(b-a)*rand(1,M); %uniformly distributed from 0 to 2 pi
m=1:M;
for n=1:N
x=cos(((2.*m-1)*pi+theta)/(4*M));
h_re(n)=1/sqrt(M)*sum(cos(2*pi*fd*x*n'*Ts+alpha));
h_im(n)=1/sqrt(M)*sum(sin(2*pi*fd*x*n'*Ts+beta));
end
h=h_re+1i*h_im;
end

Output –

Code- WCT100kmph.mlx
clc;clear;

%INPUTS
fc=2*10^9; % Carrier Frequency(Hz)
v=100*10/36; % Velocity(m/s)
c=3*10^8; % Speed of Light (m/s)
fd=v*fc/c; % Maximum Doppler Shift(Hz)
M=45; %Number of Multi-paths
N=10^4; %Number of Samples to Generate
Ts=.0001; % Sampling Period(Seconds)
%INPUTS

h=rayleighFading(M,N,fd,Ts);
figure;
subplot(2,1,1);
plot([0:N-1]*Ts,10*log10(abs(h)));
title('Amplitude Variations of Rayleigh Fading channel of 100 kmph speed');
xlabel('Time(seconds)');ylabel('Signal Level');

function [h]=rayleighFading(M,N,fd,Ts)
% function to generate Rayleigh Fading samples based on Clarke's model
% M = Number of Multi-paths in the channel
% N = Number of samples to generate
% fd = Maximum Doppler frequency
% Ts = Sampling period
a=0;
b=2*pi;
alpha=a+(b-a)*rand(1,M); %uniformly distributed from 0 to 2 pi
beta=a+(b-a)*rand(1,M); %uniformly distributed from 0 to 2 pi
theta=a+(b-a)*rand(1,M); %uniformly distributed from 0 to 2 pi
m=1:M;
for n=1:N
x=cos(((2.*m-1)*pi+theta)/(4*M));
h_re(n)=1/sqrt(M)*sum(cos(2*pi*fd*x*n'*Ts+alpha));
h_im(n)=1/sqrt(M)*sum(sin(2*pi*fd*x*n'*Ts+beta));
end
h=h_re+1i*h_im;
end

Output –

You might also like