REPORT
REPORT
REPORT
COMMUNICATION
This is a report on matlab communication consisting of 6 experiments of
Analog and Digital Communication. This report is based on the experiments
done by us on the MATLAB and the simulation of Amplitude and Frequency
modulation.
TABLE OF CONTENTS:-
INTRODUCTION TO MATLAB
GENERATION OF FOLLOWING SEQUENCES
GAUSSIAN NUMBER USING MATLAB
AMPLITUDE MODULATION USING MATLAB CODE
AMPLTUDE MODULATION USING SIMULINK
FREQUENCY MODULATION USING MATLAB CODE
I would like to thank our HOD DR. TARIQUE RASHID sir who gave us
a wonderful opportunity to prepare a report on the above
experiments. It definitely helped us to understand the simulink of
various modulations using MATLAB.
BY HARSH RAJ
SEM -5TH (22- 25)LE
EXPERIMENT NO 1
AIM:-To understand the MATLAB and various commands used in MATLAB
THEORY:
MATLAB is an interactive software that has recently been used in various fields of
engineering and scientific applications. It is not a computer language in the usual sense
but it performs most of the functions of a computer language. Writing computer code is
not a straightforward task, for beginners it is usually boring and time consuming. One
attractive aspect of MATLAB is that it is relatively easy to learn. It is written intuitively
and requires compilation and linking in most other programming languages.
The interactive mode of MATLAB may reduce computational speed in some applications. The
power of MATLAB is represented by the length and simplicity of the code. For example, one
page of MATLAB code may be equivalent to many pages of other computer language source
Note that
9 plot plot(Y)
plot(X,Y)
plot(X,Y)plots Y vs X
8 subplot subplot(m, n, p)or subplot(m n p)
9 title title('string')
Each axes graphics object can have on title. The title is located
at the top and in the center of the axes.
title('string') outputs the string at the top and in the center ofthe
current axes
10 max C = max(A)C=max(A,B)
C=max(A)return s the large settlements along different
dimensions of an array.
If A is a vector ,max(A)returns the large A.
C = max(A,B) returns an array the same size as A and B with
the largest elements taken from A or B. The dimensions of A
and B must match, or they may be scalar.
11 min C = min(A)C=min(A,B)
13 sqrt B= sqrt(X)
B = sqrt(X) returns the square root of each element of the array
X. For the elements of X that are negative or complex, sqrt(X)
produces complex results
EXPERIMENT NO 2
Theory:
A:UnitSampleSequence[(n)].
Definition-
The Dirac delta function or δ function ,is (informally)a generalized function on there a numberline
number
that is zero everywhere except at zero, with an integral of one over the entire real line. The delta
function is some times thought of as an infinitely high, infinitely thin spike at the origin, with total area
one under the spike
Mu(t−a)=0, t<a
=M ,t>a
The M in the function represents the height of the jump and a is the number of units shifted to the
right.
clc;clear
all;
closeall;
m=input('enterthevalueofm');
); n=-
10:10;
fori=1:length(n)
if n(i)==0
y(i)=1;
else
y(i)=0;
end
end
subplot(2,3,1)
stem(n,y)
xlabel('n')
ylabel('y')
title('unitsamplesequence');
);
fori=1:length(n)
ifn(i)<0||n(i)>m
y(i)=0;
else
y(i)=1;
end
end
subplot(2,3,2)
stem(n,y)
xlabel('n')
ylabel('y')
title('unitstemsequenceu(n)
'unitstemsequenceu(n)-u(n-M)');
fori=1:length(n)
if n(i)<0
y(i)=0;
else
y(i)=n(i);
end
end
subplot(2,3,3)
ylabel('y')
title('Rampsequence');
t=-pi/2:0.1:pi/2;
y=sin(2*pi*t);
subplot(2,3,4)
stem(t,y)
xlabel('t');
ylabel('y');
title('sine')
t=-pi/2:0.1:pi/2;
y=cos(2*pi*t);
subplot(2,3,5)
stem(t,y)
xlabel('t');
ylabel('y');
title('cosine')
RESULT
by X(n)=(a)n
Source Code:
clc;
a1=input('enter the value of a such that 0<=a<=1');
a2=input('enterthevalueofasuchthat-1<=a<=0');
a3=input('enter the value of a such that a<=-1');
a4=input('enter the value of a such that a>1');
forn=1:20
x1(n)=(a1)^n;
x2(n)=(a2)^n;
x3(n)=(a3)^n;
x4(n)=(a4)^n;
end
subplot(2,2,1)
stem(x1);
xlabel('-----n--->');
ylabel(' -----x1(n)-->');
title('plotofx1');
subplot(2,2,2)
stem(x2);
xlabel('-----n --->');
ylabel('-----x2(n)-->');
title('plot of x2');
subplot(2,2,3)
stem(x3);
xlabel('-----n --->');
ylabel('-----x3(n)-->');
title('plot of x3');
subplot(2,2,4)
stem(x4);
xlabel('-----n --->');
ylabel('-----x4(n)-->');
title('plot of x4');
input
Theory:
The normal distributions are a very important class of statistical distributions .All
normal distributions are symmetric and have bell-shaped
bell shaped density curves with a
single peak.
The parameter μ in this formula is the mean or expectation of the distribution (and
alsoitsmedianandmode).Theparameterσisits
).Theparameterσisitsstandarddeviation;itsvariance
varianceis
therefore σ2. A random variable with a Gaussian distribution is said to
Object5:Generate Gaussian number with mean=0 and variance=1.Plot the generated number and
calculate 3rd moment i.e. skewness using-
Skew(X,X,...,X 1 X(j)mean
1
) ^3
1 2 n
N j0
Source Code
clc;
n=50
;
r=normrnd(0,sqrt(1),1
,50); for i=1:n
y(i)=(1/sqrt(2*pi*var))*exp((-(r(i)-mean)^2)/(2*var));
end
stem
(r,y
);
xlabel(' n>');
ylabel('-----------y(x) ---- >');
title('plotofgaussianno.'
); s=0;
forx=1:n
s=s+((r(i)-mean)/var)^3;
end
skewness=
s/n;
RESULT
This is the graph showing the skewness and the level of
kurtiosisofthe normally distributed curve.
EXPERIMENT NO 4
clc
t=linspace(0,0.02,10000);%definingtimerangeforthesignal
fc=10000;%frequency of carrier signal
fm=200;%frequency of message signaql
fs=40000;%sampling frequency
------------------------------------ fs>=2(
fc+BW)
Am=5;%amplitude of the message signal
Ac=10;%amplitude of the carrier signal
m=Am/Ac%modulation index for the AM wave
wc=2*pi*fc*t;%carrierfrequencyinradians
wm=2*pi*fm*t;%messagefrequencyinradians
ec=Ac*sin(wc);%carrier signal
em=Am*sin(wm);%messagesignal
y=Ac*(1+m*cos(wm)).*cos(wc);%amplitudemodulatedsigna
l z=y.*ec; %in synchronous detection the AM signal
is
%multipliedwithcarriersignalandpassedthroughLPF
%z1=conv(z,exp(-t/0.000795));%theLPFfilterresponseintimedomainis
given
%byexp(-t/RC),thecutofffrequencyforfiltershouldbefm=200
%F=1/(2*pi*R*C),replacingF=200,and
%assumingR=1kohmthenC=0.795MICROFARAD
%soRC=0.000795
%wewillgetthedemodulatedsignalbyconvolvingtheAMsignalwithLPF
%res
pons
e
l=10
000;
subplot(4,1,1),plot(t(1:l),em(1:l))
%DEPARTMENTOFELECTRONICSANDCOMMUNICATIONENGINEERING
%ANALOGCOMMUNICATIONSLAB 15
xlabel('time(sec)');
ylabel('amplitudeinvolts(
V)'); title('MODULATING
SIGNAL');
subplot(4,1,2),plot(t(1:l/2),ec(1:l/2))
xlabel('time(sec)');
ylabel('amplitudeinvolts(
V)'); title('CARRIER
SIGNAL');
subplot(4,1,3),plot(t(1:l),y(1
:l)) xlabel('time(sec)');
ylabel('amplitude in
volts(V)');
title('AMPLITUDEMODULATEDSIGNA
L');
% subplot(4,1,4),plot(t(1:l),z1(1:l))
% xlabel('time(sec)');
%ylabel('amplitudeinvolts(V)');
%title('DEMODULATEDSIGNAL');
RESULT: This is the amplitude modulation of message signal using MATLAB code.
EXPERIMENT NO 5
AIM To understand amplitude modulation
using simulink
EXPERIMENT NO 6
AIM: To understand frequency modulation
using MATLAB code
Clc
Fs=8000;%Samplingrateofsignal
Fc = 100; % Carrier frequency
t=linspace(0,1,10000);%Samplingtime
s x = sin(2*pi*10*t) % Channel 1
dev=50;%Frequencydeviationinmodulatedsignal
y=fmmod(x,Fc,Fs,dev);%Modulatebothchannels.
z=fmdemod(y,Fc,Fs,dev);%Demodulatebothchannels.
subplot(411),plot(t,x)
xlabel('time(sec)');
ylabel('amplitudeinvolts(
V)'); title('MODULATING
SIGNAL');
subplot(412),plot(t,sin(2*pi*F
c*t)) xlabel('time(sec)');
ylabel('amplitude in
volts(V)'); title('CARRIER
SIGNAL');
subplot(413),plot(t,y)
xlabel('time(sec)');
ylabel('amplitude in
volts(V)');
title('FREQUENCYMODULATEDSIGNA
L');
subplot(414),plot(t,z)
xlabel('time(sec)');
ylabel('amplitudeinvolts(
V)'); title('DEMODULATED
SIGNAL')
By writing the above source code in the editor of the MATLAB and running it, we will get the
generated frequency waveform.