You are on page 1of 22

EXPERIMENT 01

Name of the Experiment: To determine the correlated Rayleigh MIMO Channel coefficients for
different transmitters and receivers.
Software Required: MATLAB Online with the link:
https://matlab.mathworks.com/
Theory: In wireless communications, when multiple antennas are used both at the transmitting end as well as the
receiving end, the configuration is said to be multiple input, multiple output, or MIMO. MIMO helps in sending
and receiving multiple data signals simultaneously over the same radio channel. MIMO is a smart antenna
technology, the other popular technology being multiple input, single output (MISO) and single input, multiple
output (SIMO). In traditional wireless communication systems, a single antenna is used at the transmitter site, and
another single antenna is used at the receiver site. This may give rise to multipath effects. Multipath effects arise
when obstructions in the line of propagation scatters communication waves, due to which the source signal takes
multiple paths to reach the destination. The scattered portion of the signal arrives late and causes transmission
problems like fading, intermittent reception, reduction in data speed, more errors etc. When two or more antennas
are used, the trouble caused by multipath wave propagation is eliminated. The signals received by antennas at the
receiver site are combined to generate a more accurate signal.

Fig 1 – MIMO Channels (Tx and Rx)

Code and implementation:


function hh=channel_coeff(NT,NR,N,Rtx,Rrx,type)

% correlated Rayleigh MIMO channel coefficient


% Inputs:
% NT : number of transmitters
% NR : number of receivers
2
% N : length of channel matrix
% Rtx : correlation vector/matrix of Tx
% e.g.) [1 0.5], [1 0.5;0.5 1]
% Rrx : correlation vector/matrix of Rx
% type : correlation type: ’complex’ or ’field’
% Outputs:
% hh : NR x NT x N correlated channel
% uncorrelated Rayleigh fading channel, CN(1,0)
h=sqrt(1/2)*(randn(NT*NR,N)+1j*randn(NT*NR,N));
if nargin, hh=h; return; end % Uncorrelated channel
if isvector(Rtx), Rtx=toeplitz(Rtx); end
if isvector(Rrx), Rrx=toeplitz(Rrx); end
% Narrow band correlation coefficient
if strcmp(type,'complex')
C =chol(kron(Rtx,Rrx))'; % Complex correlation
else
C =sqrtm(sqrt(kron(Rtx,Rrx))); % Power (field) correlation
end
% Apply correlation to channel matrix
NR=2;
NT=2;
N=4;
hh=zeros(NR,NT,N);
for i=1:N, tmp=C*h(:,i); hh(:,:,i)=reshape(tmp,NR,NT); end

Figures:

Fig 2 – Command window of complex channel coefficients.

Conclusions and results:


The above experiment is successfully performed with number of transmitters = 4, number of receivers
= 4, Length of channel matrix =8, Channel matrix, RTx =[1 0.5] and Rrx = [0.5 1]. The output is
normally distributed and is in the form of channel matrix of dimension Nt*Nr*N (Here 4*4*8) for the
complex channel coefficients.
Similarly, the output is obtained for the field channel coefficients with different parameters.
Experiment 02:
Name of the experiment: To determine the MIMO channel ergodic capacity Cumulative distribution
function.

Software Required: MATLAB Online with the link:


https://matlab.mathworks.com/

Theory:
In wireless communications, when multiple antennas are used both at the transmitting end as well as
the receiving end, the configuration is said to be multiple input, multiple output, or MIMO.
Ergodic capacity is the upper bound of the capacity on the statistics channel (i.e. time-varying
channel). It can be evaluated by averaging the capacity is obtained at a particular time instance on a
fading channel over an infinite time interval. That is only required to know the knowledge of the
upper bound capacity of the fading channel, when the transmitter doesn't have channel state
information and source symbol are uniformly distributed.
The ergodic capacity since a stationary ergodic random fading process is required if the statistical
properties shall be deducible from a single sequence of channel realizations.

Code:
% Ergodic_Capacity_CDF.m
clear all, close all
SNR_dB=10; SNR_linear=10.^(SNR_dB/10.);
N_iter=50000; sq2=sqrt(0.5); grps = ['b:'; 'b-'];
for Icase=1:2
if Icase==1, nT=2; nR=2; % 2x2
else
nT=4; nR=4; % 4x4
end
n=min(nT,nR); I = eye(n);
for iter=1:N_iter
H = sq2*(randn(nR,nT)+1j*randn(nR,nT));
C(iter) = log2(real(det(I+SNR_linear/nT*H'*H)));
end
[PDF,Rate] = hist(C,50);
PDF = PDF/N_iter;
for i=1:50
CDF(Icase,i) = sum(PDF([1:i]));
end
plot(Rate,CDF(Icase,:),grps(Icase,:)); hold on
end

xlabel('Rate[bps/Hz]'); ylabel('CDF')
axis([1 18 0 1]); grid on; set(gca,'fontsize',10);
legend('{\it N_T}{\it N_R}=2','{\it N_T}={\it N_R}=4');
Figures:

Fig – Rate vs CDF for different Nr and Nt

Conclusions and results:


The ergodic channel capacity CDF is successfully calculated for the MIMO channel with different Nt
and Nr.
The graph is obtained with rate (bps/Hz) on one side and CDF on the other side for the given
SNR_dB=10.
It is also concluded that the Nt= Nr=4 has higher rate than Nt=Nr=2 for the given CDF.
Experiment 03:
Name of the experiment: To determine the MIMO channel ergodic capacity for different signal to
noise ratio (SNR).

Software Required: MATLAB Online with the link:


https://matlab.mathworks.com/

Theory:
SNR is defined as the ratio of signal power to the noise power, often expressed in decibels. A ratio
higher than 1:1 (greater than 0 dB) indicates more signal than noise.
SNR, bandwidth, and channel capacity of a communication channel are connected by the Shannon–
Hartley theorem. SNR measures the ratio between an arbitrary signal level (not necessarily the most
powerful signal possible) and noise. Measuring signal-to-noise ratios requires the selection of a
representative or reference signal.
SNR is usually taken to indicate an average signal-to-noise ratio, as it is possible that instantaneous
signal-to-noise ratios will be considerably different.
Ergodic capacity is the upper bound of the capacity on the statistics channel (i.e. time-varying
channel). It can be evaluated by averaging the capacity is obtained at a particular time instance on a
fading channel over an infinite time interval.
Here, for different SNR level , the rate/ergodic capacity of the channel increases logarithmically with
increase in the no.of trnsmitters and no.of receivers.

Code:

% Ergodic_Capacity_vs_SNR.m
clear all, close all
SNR_dB=[0:5:20]; SNR_linear=10.^(SNR_dB/10);
N_iter=1000; sq2 = sqrt(0.5);
for Icase=1:5
if Icase==1, nT=1; nR=1; % 1x1
elseif Icase==2, nT=1; nR=2; % 1x2
elseif Icase==3, nT=2; nR=1; % 2x1
elseif Icase==4, nT=2; nR=2; % 2x2
else
nT=4; nR=4; % 4x4
end
n=min(nT,nR); I = eye(n);
C(Icase,:) = zeros(1,length(SNR_dB));

7
for iter=1:N_iter
H = sq2*(randn(nR,nT)+1j*randn(nR,nT));
if nR>=nT, HH = H'*H;
else
HH = H*H';
end
for i=1:length(SNR_dB) % Random channel generation
C(Icase,i) = C(Icase,i)+log2(real(det(I+SNR_linear(i)/nT*HH)));
end
end
end
C = C/N_iter;
plot(SNR_dB,C(1,:),'b-o', SNR_dB,C(2,:),'b-', SNR_dB,C(3,:),'b-s');
hold on, plot(SNR_dB,C(4,:),'b->', SNR_dB,C(5,:),'b-^');
xlabel('SNR[dB]'); ylabel('bps/Hz');

Figure:

Fig – Rate vs SNR for different Nt*Nr

Conclusions and results:

The ergodic channel capacity is successfully calculated for the MIMO channel for different SNRs
with different Nt and Nr.
The graph is obtained with rate (bps/Hz) on one side and SNR(dB) on the other side for the different
SNR_dB and different cases.
It is concluded that for different SNR level , the rate/ergodic capacity of the channel increases
logarithmically with increase in the no.of trnsmitters and no.of receivers in MIMO channel.
Experiment 04:
Name of the experiment: To build the 2×2 MIMO system using Simulink.

Software Required: MATLAB Online and Simulink with the link:


https://matlab.mathworks.com/

Theory: In wireless communications, when multiple antennas are used both at the transmitting end as well as
the receiving end, the configuration is said to be multiple input, multiple output, or MIMO. MIMO helps in
sending and receiving multiple data signals simultaneously over the same radio channel. For narrowband MIMO
systems, the MIMO channel is characterized by its matrix H of size N x M, where N is the number of transmit
antennas and M is the number of receive antennas. This can be the case of MIMO systems using Orthogonal
Frequency Division Modulation (OFDM) where each sub-channel can be considered as a SISO (Single Input
Single Output) flat channel (frequency not-selective channel).
The 2×2 MIMO can be assumed using two SISO receivers. In SISO system only one antenna is there at the
transmitter end and one antenna at receiver end and in MIMO, we have multiple antennas.
It is also known that MIMO system achieves higher Bit Error rate compare to SISO for the given SNR. This is
achieved using technique called STBC (Space Time Block Coding).
MIMO system also provides higher data rate due to transmission of multiple data symbols simultaneously using
multiple antennas, and this method is called as Spatial Multiplexing (SM).

Simulink model:
Figures:
Conclusions:
The 2×2 MIMO system using Simulink is developed by assuming two SISO receivers properly.

It is concluded that the MIMO system can be obtained using its SISO counterpart by following the
same simulation approach as followed above.
EXPERIMENT 05:
Name of the experiment: To generate binary ASK, FSK and PSK for the given input signal.

Software required: MATLAB Online and Simulink with the link:


https://matlab.mathworks.com/

Theory:

Amplitude-shift keying (ASK), frequency-shift keying (FSK), and phase-shift keying (PSK) are
digital modulation schemes.ASK refers to a type of amplitude modulation that assigns bit values to
discrete amplitude levels. The carrier signal is then modulated among the members of a set of discrete
values to transmit information.

FSK refers to a type of frequency modulation that assigns bit values to discrete frequency levels. FSK
is divided into noncoherent and coherent forms. In noncoherent forms of FSK, the instantaneous
frequency shifts between two discrete values termed the "mark" and "space" frequencies. In coherent
forms of FSK, there is no phase discontinuity in the output signal. FSK modulation formats generate
modulated waveforms that are strictly real values, and thus tend not to share common features with
quadrature modulation schemes.

PSK in a digital transmission refers to a type of angle modulation in which the phase of the carrier is
discretely varied—either in relation to a reference phase or to the phase of the immediately preceding
signal element—to represent data being transmitted.

Code

data=[1,0,1,0,1,1,1,0,0,1,0,1];

x=1:0.05:12;
n=size(x);
fc=2000;
fch=5000;
signal=sin(fc*x);
signal2=sin(fch*x);

ASK=zeros(size(signal));
PSK=zeros(size(signal));
FSK=zeros(size(signal));
y=zeros(n);
k=0;
for i=1:n(2),
if(floor(x(i))==x(i))
y(i)=data(x(i))
ASK(i)=data(x(i))*signal(i);
if(y(i)==0)
PSK(i)=-1*signal(i);
else
PSK(i)=signal(i);
end
if(y(i)==0)
FSK(i)=signal(i);
else
FSK(i)=signal2(i);
end
k=data(x(i));
else
y(i)=k;
ASK(i)=y(i)*signal(i);
if(y(i)==0)
PSK(i)=-1*signal(i);
else
PSK(i)=signal(i);
end
if(y(i)==0)
FSK(i)=signal(i);
else
FSK(i)=signal2(i);
end
end

end
figure
subplot(2,2,1)
plot(x,y,'r');
axis([1 15 0 2]);
title('Input');
subplot(2,2,2)
plot(x,ASK,'b');
axis([1 15 -1 1]);
title('ASK');
subplot(2,2,3)
plot(x,PSK,'b');
axis([1 15 -1 1]);
title('PSK');
subplot(2,2,4)
plot(x,FSK,'b');
axis([1 15 -1 1]);
title('FSK');

Figures
Conclusion:
The Binary ASK, PSK and FSK for given input signal is successfully implemented. We can take
different such input data and obtain these output signals and analyse the difference between these
modulation schemes using waveforms.
Experiment 06:
Name of the experiment: Generation, transmission, reception of OFDM signal without noise.
Sofware required: MATLAB Online and Simulink with the link:
https://matlab.mathworks.com/

Theory: OFDM, Orthogonal Frequency Division Multiplexing is a form of signal waveform or


modulation that provides some significant advantages for data links. Accordingly, OFDM, Orthogonal
Frequency Division Multiplexing is used for many of the latest wide bandwidth and high data rate
wireless systems including Wi-Fi, cellular telecommunications and many more. The fact that OFDM
uses a large number of carriers, each carrying low bit rate data, means that it is very resilient to
selective fading, interference, and multipath effects, as well providing a high degree of spectral
efficiency.

Early systems using OFDM found the processing required for the signal format was relatively high,
but with advances in technology, OFDM presents few problems in terms of the processing required.
Transmission: An OFDM carrier signal is the sum of a number of orthogonal subcarriers, with
baseband data on each subcarrier being independently modulated commonly using some type of
quadrature amplitude modulation (QAM) or phase-shift keying (PSK). This composite baseband
signal is typically used to modulate a main RF carrier.
S[n] is a serial stream of binary digits. By inverse multiplexing, these are first demultiplexed into N
parallel streams, and each one mapped to a (possibly complex) symbol stream using some modulation
constellation (QAM, PSK, etc.). Note that the constellations may be different, so some streams may
carry a higher bit-rate than others.
An inverse FFT is computed on each set of symbols, giving a set of complex time-domain samples.
These samples are then quadrature-mixed to passband in the standard way. The real and imaginary
components are first converted to the analogue domain using digital-to-analogue converters (DACs);
the analogue signals are then used to modulate cosine and sine waves at the carrier frequency,
respectively. These signals are then summed to give the transmission signal.
Fig – Transmitter circuit

Receiver: The receiver picks up the signal r(t), which is then quadrature-mixed down to baseband
using cosine and sine waves at the carrier frequency. This also creates signals centered on 2fc so low-
pass filters are used to reject these. The baseband signals are then sampled and digitised using analog-
to-digital converters (ADCs), and a forward FFT is used to convert back to the frequency domain.
This returns N parallel streams, each of which is converted to a binary stream using an appropriate
symbol detector. These streams are then re-combined into a serial stream, s(n), which is an estimate of
the original binary stream at the transmitter.

Fig- Receiver Circuit

Code:

clear all
clc
close all
% ---------------
% A: Setting Parameters
% ---------------
M = 4; % QPSK signal constellation
no_of_data_points = 64; % have 64 data points
block_size = 8; % size of each ofdm block
cp_len = ceil(0.1*block_size); % length of cyclic prefix
no_of_ifft_points = block_size; % 8 points for the FFT/IFFT
no_of_fft_points = block_size;
% 1. Generate 1 x 64 vector of data points phase representations
data_source = randsrc(1, no_of_data_points, 0:M-1);
figure(1)
stem(data_source);
grid on;
xlabel('data points');
ylabel('transmitted data phase representation')
title('Transmitted Data "O"')
% 2. Perform QPSK modulation
qpsk_modulated_data = pskmod(data_source, M);
scatterplot(qpsk_modulated_data);
title('qpsk modulated transmitted data')

% 3. Do IFFT on each block


% Make the serial stream a matrix where each column represents a pre-OFDM
% block (w/o cyclic prefixing)
% First: Find out the number of colums that will exist after reshaping
num_cols=length(qpsk_modulated_data)/block_size;
data_matrix = reshape(qpsk_modulated_data, block_size, num_cols);
% Second: Create empty matix to put the IFFT'd data
cp_start = block_size-cp_len;
cp_end = block_size;

% Third: Operate columnwise & do CP


for i=1:num_cols,
ifft_data_matrix(:,i) = ifft((data_matrix(:,i)),no_of_ifft_points);
% Compute and append Cyclic Prefix
for j=1:cp_len,
actual_cp(j,i) = ifft_data_matrix(j+cp_start,i);
end
% Append the CP to the existing block to create the actual OFDM block
ifft_data(:,i) = vertcat(actual_cp(:,i),ifft_data_matrix(:,i));
end

% 4. Convert to serial stream for transmission


[rows_ifft_data cols_ifft_data]=size(ifft_data);
len_ofdm_data = rows_ifft_data*cols_ifft_data;
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(ifft_data, 1, len_ofdm_data);
figure(3)
plot(real(ofdm_signal)); xlabel('Time'); ylabel('Amplitude');
title('OFDM Signal');grid on;
% ------------------------------------------
% E: % +++++ RECEIVER +++++
% ------------------------------------------

% 1. Pass the ofdm signal through the channel


recvd_signal = ofdm_signal;

% 4. Convert Data back to "parallel" form to perform FFT


recvd_signal_matrix = reshape(recvd_signal,rows_ifft_data, cols_ifft_data);

% 5. Remove CP
recvd_signal_matrix(1:cp_len,:)=[];

% 6. Perform FFT
for i=1:cols_ifft_data,
% FFT
fft_data_matrix(:,i) = fft(recvd_signal_matrix(:,i),no_of_fft_points);
end
% 7. Convert to serial stream
recvd_serial_data = reshape(fft_data_matrix, 1,(block_size*num_cols));

% 8. Demodulate the data


qpsk_demodulated_data = pskdemod(recvd_serial_data,M);
scatterplot(qpsk_modulated_data);title('qpsk modulated received data')

figure(5)
stem(qpsk_demodulated_data,'rx');
grid on;xlabel('data points');ylabel('received data phase
representation');title('Received Data "X"')

Figures:
18

Conclusions:
The OFDM signal is properly generated , transmitted and received without considering any noise
using QPSK modulations.
The graph is obtained as a result containing- QPSK modulated transmitted data, transmitted data, OFDM
signal, QPSK modulated received data, received data and waveforms generated are accurate.
Experiment 07:
Name of the experiment: BER vs. SNR of OFDM LTE AWGN (Transmitter and Receiver).
Sofware required: MATLAB Online and Simulink with the link:
https://matlab.mathworks.com/

Theory:
The bit error rate (BER) is the number of bit errors per unit time. The bit error ratio (also BER) is
the number of bit errors divided by the total number of transferred bits during a studied time interval.
Bit error ratio is a unitless performance measure, often expressed as a percentage. In digital
transmission, the number of bit errors is the number of received bits of a data stream over a
communication channel that have been altered due to noise, interference, distortion or bit
synchronization errors.
SNR is defined as the ratio of signal power to the noise power, often expressed in decibels. A ratio
higher than 1:1 (greater than 0 dB) indicates more signal than noise.
SNR, bandwidth, and channel capacity of a communication channel are connected by the Shannon–
Hartley theorem. SNR measures the ratio between an arbitrary signal level (not necessarily the most
powerful signal possible) and noise. Measuring signal-to-noise ratios requires the selection of a
representative or reference signal. In audio engineering, the reference signal is usually a sine wave at
a standardized nominal or alignment level, such as 1 kHz at +4 dBu (1.228 VRMS).
SNR is usually taken to indicate an average signal-to-noise ratio, as it is possible that instantaneous
signal-to-noise ratios will be considerably different. The concept can be understood as normalizing
the noise level to 1 (0 dB) and measuring how far the signal 'stands out'.

Codes:

The codes are separately executed for the qam and psk modulation schemes.

i) PSK

clc;
clear all;
close all;

% Initializing parameters
Nfft=input('fft size N = ');
Nused=input('Number of OFDM symbols used m = ');
M=input('constellation size M = ');
Phase_Offset=input('phase offset = ');
Ncp=input('cyclic prefix samples Ncp = ');

% Transmitter

Tx_data=randi([0 M-1],Nused,Nfft);
mod_data = pskmod(Tx_data,M,0);

% data generation

% modulation

% Serial to Parallel
s2p=mod_data.';
% insertion of pilots (upsmapling)
upsampled=upsample(s2p,1);
% Amplitude modulation (IDFT using fast version IFFT)
am=ifft(upsampled,Nfft);
% Parallel to serial
p2s=am.';
% Cyclic Prefixing
CP_part=p2s(:,end-Ncp+1:end); % this is the Cyclic Prefix part to be appended.
cp=[CP_part p2s];
% Reciever
% Adding Noise using AWGN
SNRstart=3;
SNRincrement=2;
SNRend=11;
c=0;
r=zeros(size(SNRstart:SNRincrement:SNRend));
for snr=SNRstart:SNRincrement:SNRend
c=c+1;
noisy=awgn(cp,snr,'measured');
% Remove cyclic prefix part
cpr=noisy(:,Ncp+1:Nfft+Ncp); %remove the Cyclic prefix
% serial to parallel
parallel=cpr.';
% Amplitude demodulation (DFT using fast version FFT)
amdemod=fft(parallel,Nfft);
% Down-Sampling
downsampled=downsample(amdemod,1);
% Parallel to serial
rserial=downsampled.';
% demodulation
Umap=pskdemod(rserial,M,0);
% Calculating the Symbol Error Rate
[n, r(c)]=symerr(Tx_data,Umap);
end
snr=SNRstart:SNRincrement:SNRend;
% Plotting SER vs SNR
semilogy(snr,r,'-ok');
grid;
axis([3 11 0.01 1]);
title('OFDM Symbol Error Rate vs SNR');
ylabel('Symbol Error Rate');
xlabel('SNR [dB]');

ii) QAM:

clc;
clear all;
close all;

% Initializing parameters
Nfft=input('fft size N = ');
Nused=input('Number of OFDM symbols used m = ');
M=input('constellation size M = ');
Phase_Offset=input('phase offset = ');
Ncp=input('cyclic prefix samples Ncp = ');

% Transmitter

Tx_data=randi([0 M-1],Nused,Nfft);
mod_data = qammod(Tx_data,M);

% data generation

% modulation

% Serial to Parallel
s2p=mod_data.';
% insertion of pilots (upsmapling)
upsampled=upsample(s2p,1);
% Amplitude modulation (IDFT using fast version IFFT)
am=ifft(upsampled,Nfft);
% Parallel to serial
p2s=am.';
% Cyclic Prefixing
CP_part=p2s(:,end-Ncp+1:end); % this is the Cyclic Prefix part to be appended.
cp=[CP_part p2s];
% Reciever% Adding Noise using AWGN
SNRstart=3;
SNRincrement=2;
SNRend=11;
c=0;
r=zeros(size(SNRstart:SNRincrement:SNRend));
for snr=SNRstart:SNRincrement:SNRend
c=c+1;
noisy=awgn(cp,snr,'measured');
% Remove cyclic prefix part
cpr=noisy(:,Ncp+1:Nfft+Ncp); %remove the Cyclic prefix
% serial to parallel
parallel=cpr.';
% Amplitude demodulation (DFT using fast version FFT)
amdemod=fft(parallel,Nfft);
% Down-Sampling
downsampled=downsample(amdemod,1);
% Parallel to serial
rserial=downsampled.';
% demodulation
Umap=qamdemod(rserial,M);
% Calculating the Symbol Error Rate
[n, r(c)]=symerr(Tx_data,Umap);
end

snr=SNRstart:SNRincrement:SNRend;
% Plotting SER vs SNR
semilogy(snr,r,'-ok');
grid;
title('OFDM Symbol Error Rate vs SNR');
ylabel('Symbol Error Rate');
xlabel('SNR [dB]');

Figures:

1. PSK- The results are obtained for fft size N = 64


Number of OFDM symbols used m = 4
constellation size M = 8
phase offset = 0
cyclic prefix samples Ncp = 8
Conclusions:
The OFDM BER vs SNR is analysed for PSK with the following specifications: fft size N = 64,
Number of OFDM symbols used m = 4, constellation size M = 8, phase offset = 0, cyclic prefix samples

You might also like