In this example, we will see how we can model a simple communication channel. We will consider two cases : A simple Additive Gaussian noise channel and Rayleigh fading channel. Our signals are complex variables here which signifies both I and Q components.

A channel is the medium between the transmitter and receiver. The signals (for example electromagnetic waves) transmitted from the source face different materials in the medium (air, water, buildings, dust or static charges around) it may increase the signal strength or decrease it by some random factor. This is called fading and this factor is called fading variable.

It can also add some random component to the transmitted signal. We can see this as additive noise. When this component follows a Gaussian distribution we call it additive Gaussian Noise.

Let us generate a random bit stream which signifies the date need to be sent. We choose the probability of 1 occurring is 0.6. First we generate a random uniform random vector.

for QPSK, the rule is

Fig1: Communication System |

__Channel__A channel is the medium between the transmitter and receiver. The signals (for example electromagnetic waves) transmitted from the source face different materials in the medium (air, water, buildings, dust or static charges around) it may increase the signal strength or decrease it by some random factor. This is called fading and this factor is called fading variable.

It can also add some random component to the transmitted signal. We can see this as additive noise. When this component follows a Gaussian distribution we call it additive Gaussian Noise.

__Signal Modelling__Let us generate a random bit stream which signifies the date need to be sent. We choose the probability of 1 occurring is 0.6. First we generate a random uniform random vector.

Now let us turn all the elements bigger than 0.4 to 1 and rest to 0. Note that since the original vector is uniform between 0 and 1, the output vector will have 1 with 0.6 probability.u=rand(1000,1)

d=zeros(1000,1);

u(d>0.4)=1;

__Modulation:__
We can further modulate this signal using any modulation scheme. Let us choose few of modulation schemes and compare their outputs.

**a) BPSK**

This means -1 denotes 0 bit and +1 denotes 1 bit. let us change all the 0s to -1 and 1s to +1. The transmitted signal can we written as

y=zeros(1000,1);

y(d==0)=-1;

y(d==1)=+1;

Note that each -1 and 1 denotes a sin pulse with phase -180 and +180 with time length equal to symbol duration . We will not consider the anolog signal which is in form concatenated sin signals. The receiver considers whole duration pulse as one and decide the phase. This requires synchronization which is not covered in this tutorial.

**B) QPSK or QAM**

Let us first divide the signal into I and Q data streams components. Each even numbered data bit is for Q.

dI=d(1:2:999);

dQ=d(2:2:1000);

The transmitted signal can we written as

x=zeros(500,1);x(dI==0 && dQ==0)=sqrt(1/2)*(1+1j);

x(dI==0 && dQ==1)=sqrt(1/2)*(-1+1j);

x(dI==1 && dQ==1)=sqrt(1/2)*(-1-1j);

x(dI==1 && dQ==0)=sqrt(1/2)*(1-1j);

__Channel Modeling__

__1. Additive gaussian Noise__
Let us first consider the simple channel which just adds the Gaussian noise. noise vector is of the same dimension , one noise value for each symbol duration and each noise value is independent of previous

symbol. We choose the noise variance as 0.01 and mean as 0.

symbol. We choose the noise variance as 0.01 and mean as 0.

m=0;

s=sqrt(.01);

N=size(x);

n=m+s*rand(N);

So the output signal which is received at receiver is

y=x+n;

__2. Fading__
Let us consider the fading which multiplies to the transmitted signal. As previous, here also each value is independent. We consider Rayleigh fading which means each symbol is Rayleigh distributed. .

h=sqrt(1/2)(randn(N,1)+1j*randn(N,1));

y=h*x+n;

__Receiver Model__
We implement simple decoder which computes the phase of signal (as both of them are PSK) and decide upon this. For BPSK, it is equivalent to the following rule

dhat= 1 if y >0

dhat =0 if y<0

dhat= 1 if y >0

dhat =0 if y<0

for QPSK, the rule is

dIhat = 1 if imaginary part of y<0 otherwise dIhat=1;

dQhat = 1 if real part of y<0 otherwise dQhat=1;

Let us implement both of these

BPSK:

QPSK:dhat=zeros(1000,1);

dhat(y>0)=1;

dIhat=zeros(500,1);

dIhat(imag(y)<0)=1;

dQhat=zeros(500,1);

dQhat(real(y)<0)=1;

dhat=zeros(1000,1);

dhat(1:2:999)=dIhatl

dhat(2:2:1000)=dQhat;

__BER performance__
Now let us compare the bit error rate which is defined as the ratio of error bit to the total bits transmitted.

e=(d!=dhat);

ber=sum(e)/1000;

https://www.youtube.com/watch?v=frq4xElV4vU&list=PLT9Fml21iFqNmKkkZrrtgXngneurFRhp0&index=1

ReplyDeletehttp://np-software.blogspot.com

ReplyDeleteI just found a website who give 74% OFF coupon to Learn Matlab Udemy course

ReplyDeletehttps://www.udemy.com/learn-matlab/?couponCode=MATLAB25

www.bluecanetechnologies.com

ReplyDeleteIT Consulting South Florida

Computer Consulting south florida

Managed IT Services South Florida

Cloud Solutions South Florida

IT Security South Florida

Hey nice sharing for understanding matlab keep sharing such nice post

ReplyDeleteThanks for the code... and let tell you that i have also write code for fft matlab not even that you will also find some useful tuts for Radix-2 fft and Radix-4 fft.

ReplyDelete