You are on page 1of 29

INDEX

Page
S.No. Aim Date
No.
To generate the different types of signals in
continuous and discrete domain (unit step, unit
1 2/4/21 1
ramp, sinusoidal, exponential and delta signal)
using MATLAB.

To generate the Amplitude modulated wave


2 9/4/21 8
using MATLAB.

To study the effect of modulation index on AM


3 16/4/21 12
wave using MATLAB.

To generate the demodulated signal of


4 21/5/21 16
Amplitude Modulated signal using MATLAB.

To find the mean and variance of random


5 28/5/21 18
variables using MATLAB

To generate the binomial distribution graph


6 4/6/21 20
(unequal and equal) using MATLAB.

To generate the Phase modulated signal using


7 11/6/21 23
MATLAB.

To generate the Frequency modulated signal


8 18/6/21 26
using MATLAB.
DATE: Page Number-1

Experiment 1

Aim: To generate the different types of signals in continuous and discrete


domain (unit step, unit ramp, sinusoidal, exponential and delta signal)
using MATLAB.

Software Used: MATLAB


Theory:
1) Unit Step Signal: From its origin to one unit on the X--axis, the unit step
signal has a value of one. This signal is mostly used for testing
purposes. Below is a representation of a unit step signal.

The unit step function is denoted by u(t).. It is defined as –

2) Unit Ramp Signal: The value of the unit ramp signal grows
exponentially from its origin. Below is an image of a unit ramp signal.
Page Number-2

The unit ramp function is denoted by u(t). It is defined as –

3) Sinusoidal Signal: The value of a Sinusoidal signal varies sinusoidally


from its origin. Below is a representation of a Sinusoidal signal.

The sinusoidal function is denoted by x(


x(t).. It is defined as –
Page Number-3

4) Exponential signal: The value of an exponential signal varies


exponentially from its origin. The exponential function looks like this:

X(t) =eαt

The shape of exponential can be defined by α.


Page Number-4

5) Delta signal or Unit Impulse signal : The delta signal or unit impulse
signal has the value of one unit at its origin. Its area is one unit.

The unit impulse function is denoted by δ(t) It is defined as


Page Number-5

Code:
clc;
clear all;
close all;
t=-5:0.0001:5;
y=[t>=0];
subplot(2,6,1);
plot(t,y,'r');
title('1(a) Cont. unit step func');
xlabel('t')
ylabel('u(t)')
axis([-5 5 0 3]);
subplot(2,6,2);
t=-5:5;
y=[t>=0];
stem(t,y);
xlabel('t')
ylabel('u(t)')
title('1(b) Disc. unit step func');
axis([-5 5 0 3]);

t=linspace(-5,5);
y=t.*[t>=0];
subplot(2,6,3);
plot(t,y,'g');
title('2(a) Cont. ramp func');
xlabel('t')
ylabel('r(t)')
subplot(2,6,4);
t=-5:5;
y=t.*[t>=0];
stem(t,y);
title('2(b) Disc. ramp func');
xlabel('t')
ylabel('r(t)')

t=linspace(0,10);
y=sin(t);
subplot(2,6,5);
plot(t,y,'y');
title('3(a) continuous sine func');
xlabel('t')
ylabel('sin(t)')
subplot(2,6,6);
Page Number-6

t=0:0.2:10;
y=sin(t);
stem(t,y);
title('3(b) discrete sine func');
xlabel('t')
ylabel('sin(t)')

t=linspace(0,5);
y=exp(t);
subplot(2,6,7);
plot(t,y,'y');
title('4(a) continuous exp func');
xlabel('t')
ylabel('exp(t)')
subplot(2,6,8);
t=0:0.2:5;
y=exp(t);
stem(t,y);
title('4(b) discrete exp func');
xlabel('t')
ylabel('exp(t)')

t=linspace(0,5);
y=exp(-t);
subplot(2,6,9);
plot(t,y,'y');
title('4(c) continuous exp func');
xlabel('t')
ylabel('exp(t)')
subplot(2,6,10);
t=0:0.2:5;
y=exp(-t);
stem(t,y);
title('4(d) discrete exp func');
xlabel('t')
ylabel('exp(t)')

t = (-1:0.01:1);
delta = t==0;
subplot(2,6,11);
plot(t,delta,'r');
title('5(a) cont. delta func');
xlabel('t')
ylabel('y(t)')
t = (-1:0.01:1);
Page Number-7

delta = t==0;
subplot(2,6,12);
stem(t,delta);
title('5(b) disc. delta func');
xlabel('t')
ylabel('y(t)')

Output:

Conclusion:
The plots show various signals in the continuous and discrete domains.
DATE: Page Number-8

Experiment 2

Aim: To generate the Amplitude modulated wave using MATLAB.


Software Used: MATLAB
Theory: The information is contained in the baseband message signal,
which is a continuous-wave
wave that continues without interruption.
Modulation is required for this wave.

“The amplitude of the carrier signal varies in line with the instantaneous
amplitude of the modulating signal,” according to the standard definition.
This means that at any given time, the amplitude of the carrier sign
signal
containing no information varies in proportion to the amplitude of the signal
carrying information. The following diagrams can help to clarify this.
Page Number-9

The modulating wave, which is the message signal, is depicted in the first
image. The carrier wave, which is a high
high-frequency
frequency signal with no
information, comes next. The resultant modulated wave is the last one.

The carrier wave's positive and negative peaks are connected by an


imaginary line, which may be seen. This line a aids
ids in reproducing the
modulating signal's exact form. Envelope is the name given to this
imaginary line on the carrier wave. It's the same as when a message is sent.

Code:
clc;
clear all;
close all;
Am=3.5;
fm=2000;
Ac=5;
fc=6000;
t=7;
m=Am/Ac;
T=linspace(0,t,1000);
Mt=Am*cos(2*pi*fm*T);
subplot(3,1,1);
Page Number-10

plot(T,Mt);
xlabel('Time');
ylabel('Amplitude');
title('Msg signal');
Ct=Ac*cos(2*pi*fc*T);
Xam=Ac.*(1+m.*cos(2*pi*fm*T)).*cos(2*pi*fc*T);
subplot(3,1,2);
plot(T,Ct);
xlabel('Time');
ylabel('Amplitude');
title('Carrier signal');
subplot(3,1,3);
plot(T,Xam);
xlabel('Time');
ylabel('Amplitude');
title('Amplitude Modulated signal');

Output:

Conclusion: Generation of Amplitude modulated has been done.


DATE: Page Number-11

Experiment 3
Aim: To study the effect of modulation index on AM wave using MATLAB.
Software Used: MATLAB
Theory:
Modulation Index: The attempt to compute the modulated level after a
carrier wave has been modulated is referred to as the Modulation Index or
Modulation Depth. It describes the amount of modulation received by a
carrier wave.

s(t)=Ac[1+(Am/Ac)cos(2πfmt)]cos(2πfct)

s(t)=Ac[1+μcos(2πfmt)]cos(2πfct)

Where, μ is Modulation index and it is equal to the ratio of Am and Ac.


Mathematically, we can write it as
μ=Am/Ac
Let Amax and Amin be the maximum and minimum amplitudes of the
modulated wave.

We will get the maximum amplitude of the modulated wave,


when cos(2πfmt) is 1.

⇒Amax=Ac+Am

We will get the minimum amplitude of the modulated wave,


when cos(2πfmt) is -1.

⇒Amin=Ac−Am
Page Number-12

For example, if this number is less than 1, indicating that the modulation
index is 0.5, the modulated output will appear like this. Under-modulation
Under
is the term for it. A wave like this is known as an under-modulated
modulated wave.
wave

If the value of the modulation index is equal to 1, then the wave will be
an critical modulated wave
wave.. It would look like the following figure.

If the modulation index value is greater than 1, i.e. 1.5 or so, the wave will
be over-modulated. It would look something like the diagram below.
Page Number-13

Code:
clc;
clear all;
close all;
Am=10;
fm=1000;
Ac=7.5;
fc=12000;
t=10;
T=linspace(0,t,1000);
m = 0.5;
Xam=Ac.*(1+m.*cos(2*pi*fm*T)).*cos(2*pi*fc*T);
subplot(3,1,1);
plot(T,Xam);
xlabel('Time');
ylabel('Amplitude');
title('Under Modulation');

m = 1;
Xam=Ac.*(1+m.*cos(2*pi*fm*T)).*cos(2*pi*fc*T);
subplot(3,1,2);
plot(T,Xam);
xlabel('Time');
ylabel('Amplitude');
title('Critical Modulation');

m = 1.5;
Xam=Ac.*(1+m.*cos(2*pi*fm*T)).*cos(2*pi*fc*T);
subplot(3,1,3);
plot(T,Xam);
xlabel('Time');
ylabel('Amplitude');
title('Over Modulation');
Page Number-14

Output:

Conclusion: Waves have been created for m=1 (Critical Modulation), m>1
(Over Modulation), and m1 (Under Modulation).
DATE: Page Number-15

Experiment 4
Aim: To generate the demodulated signal of Amplitude Modulated signal
using MATLAB.

Software used: MATLAB.


Theory:
level AM waves are demodulated using a square law demodulator.
Low-level demodulator The
square law demodulator's block diagram is shown below.

This demodulator contains a square law device and low pass filter. The AM
wave V1(t)V1(t) is applied as an input to this demodulator.
The standard form of AM wave is

We know that the mathematical relationship between the input and the
output of square law device is

Where,
is the input of the square law device, which is nothing but the AM
wave
V is the output of the square law device
are constants
Substitute V1(t) in Equation 1
Page Number-16

In the above equation, the term is the scaled version of the


message signal. It can be extracted by passing the above signal through a
low pass filter and the DC component can be eliminated with the help
of a coupling capacitor.

Code:
clc;
clear all;
close all;
Am=10;
fm=200;
Ac=10;
fc=5000;
t=0.02;
m=Am/Ac;
fs=30000;
a=3;b=5;
t1=linspace(0,t,1000);
mt=Am*sin(2*pi*fm*t1);
ct=Ac*sin(2*pi*fc*t1);
xam=Ac.*(1+m.*sin(2*pi*fm*t1)).*sin(2*pi*fc*t1);
d=a*xam+b*(xam.^2);
[p,q]= butter(1,fm/(fs/2));
d2=filter(p,q,d);
d1=(d2-mean(d2))/(b*Ac);
subplot(4,1,1);
plot(t1,mt);
xlabel('Time');
ylabel('Amplitude');
title('Message signal');
subplot(4,1,2);
plot(t1,ct);
xlabel('Time');
Page Number-17

ylabel('Amplitude');
title('Carrier signal');
subplot(4,1,3);
plot(t1,xam);
xlabel('Time');
ylabel('Amplitude');
title('AM signal');
subplot(4,1,4);
plot(t1,d1);
xlabel('Time');
ylabel('Amplitude');
title('Demodulated signal');

Output:

Conclusion: Demodulated signal of Amplitude Modulated signal has been


generated.
DATE: Page Number-18

Experiment 5
Aim: To find the mean and variance of random variables using MATLAB.
Software used: MATLAB
Theory:
A random variable is a variable with an unknown value or a function that
gives values to each of the results of an experiment. Random variables are
frequently denoted by letters and can be classed as discrete or continuous,
with discrete variables having specified values and continuous variables
having any value within a continuous range.

Mean of random variable: Let X be a random variable with possible values


x₁, x₂, x₃, . . . , xn occurring with probabilities p1, p2, p3, . . . ,pn respectively.
The mean of a random variable X, denoted by μ, is the weighted average of
the possible values of X, each value being weighted by its probability of
occurrence. The mean of a random variable X is also knows as expectation
of X given by,

Variance of random variable: Basically, the variance tells us how spread-


out the values of X are around the mean value. variance of a random
variable (denoted by σ2x) with values x1, x2, x3, , xn occurring with
probabilities pI ,p2, p3, . . ., pn can be given as :
Page Number-19

Code:
clc;
x=input('Enter values of x:');
px=input('Enter values of p(x):');

m=sum(x.*px);
v=sum(((x-m).^2).*px);

fprintf('\n Mean=%f',m);
fprintf('\n Variance=%f\n',v);

Output:

Conclusion: The mean and variance of the random variables were analyzed
using MATLAB.
DATE: Page Number-20

Experiment 6
Aim: To generate the binomial distribution graph (unequal and equal
probabilities) using MATLAB.

Software used: MATLAB


Theory:
Binomial Distribution: The binomial distribution is a discrete probability
distribution in probability theory and statistics that has only two possible
outcomes in an experiment: success or failure. If we toss a coin, for
example, there are only two conceivable outcomes: heads or tails, and if we
take a test, there are only two possible outcomes: pass or fail. A binomial
probability distribution is another name for this distribution. In a binomial
distribution, the parameters n and p are employed. The variable 'n'
indicates how many times the experiment will run, whereas the variable 'p'
indicates the probability of each outcome. If a dice is thrown 10 times at
random, the chance of receiving two on any one toss is 1/4. You get a
binomial distribution with n = 10 and p = 1/4 when you throw the dice 10
times.

Binomial Distribution Formula:


Page Number-21

Code:
clc;
clear all;
close all;
p=0.75;
q=1-p;
n=input('Enter the total no. of cases:');
r=input('Enter the no. of people getting recovered (favorable cases):');
m=[];
for i=0:1:r
ans=(factorial(n)/(factorial(i)*factorial(n-i))*(p^i)*(q^(n-i)));
m=[m ans];
end

i=0:1:r
subplot(2,1,1);
stem(i,m,'g');
xlabel('i');
ylabel('probility values');
title('Binomial distribution graph(Unequal)');

fprintf('The probability is: %d',ans)

p=0.5
q=1-p;
m=[];
for i=0:1:r
ans=(factorial(n)/(factorial(i)*factorial(n-i))*(p^i)*(q^(n-i)));
m=[m ans];
end

i=0:1:r
subplot(2,1,2)
stem(i,m,'g');
xlabel('i');
ylabel('probility values');
title('Binomial distribution graph(Equal)');

fprintf('The probability is: %d',ans)


Page Number-22

Output:

Conclusion: MATLAB was used to create a binomial distribution with equal


and unequal probabilities.
DATE: Page Number-23

Experiment 7
Aim: To generate the Phase modulated signal using MATLAB.
Software used: MATLAB
Theory:
In Phase Modulation (PM), the carrier signal's phase changes in response to
the modulating signal's instantaneous amplitude. As a result, with phase
modulation, the carrier signal's amplitude and frequency stay constant. The
following diagrams can help you better understand this.

The phase of a modulated wave has an endless number of sites where a


phase shift might occur. The modulating signal's instantaneous amplitude
alters the carrier signal's phase. The phase changes in one direction when
Page Number-24

the amplitude is positive, and the phase changes in the opposite direction
when the amplitude is negative.

Mathematical Representation:

The equation for instantaneous phase Φi in phase modulation is


Φi = kpm(t)
Where,
 kp is the phase sensitivity
 m(t) is the message signal
The standard equation of angle modulated wave is
s(t)=Accos(2πfct+ Φi)
Substitute, Φi value in the above equation.

s(t)=Accos(2πfct+kpm(t))
This is the equation of PM wave.

Code:
clc;
Am=5;
fm=200;
Ac=10;
fc=3000;
t=0.01;
kp = pi/2;
t1=linspace(0,t,1000);
mt=Am*sin(2*pi*fm*t1);
ct=Ac*sin(2*pi*fc*t1);
st=Ac*cos(2*pi*fc*t1 + kp*mt);
subplot(3,1,1);
plot(t1,mt);
xlabel('Time');
ylabel('Amplitude');
title('Message signal');
subplot(3,1,2);
plot(t1,ct);
xlabel('Time');
ylabel('Amplitude');
title('Carrier signal');
subplot(3,1,3);
Page Number-25

plot(t1,st);
xlabel('Time');
ylabel('Amplitude');
title('PM signal');

Output:

Conclusion: MATLAB was used to generate the phase modulated signal.


DATE: Page Number-26

Experiment 8
Aim: To generate the Frequency modulated signal using MATLAB.
Software used: MATLAB
Theory:
The carrier signal's frequency varies according to the modulating signal's
instantaneous amplitude in Frequency Modulation (FM). As a result, with
frequency modulation, the carrier signal's amplitude and phase stay
constant. The following diagrams can help you understand this better.
Page Number-27

Mathematical Representation

The equation for instantaneous frequency fi in FM modulation is


fi=fc+kfm(t)
Where,
fc is the carrier frequency
kf is the frequency sensitivity
m(t) is the message signal
We know the relationship between angular frequency ωi and angle θi(t) as
ωi=dθi(t)/dt
⇒2πfi=dθi(t)/dt
⇒θi(t)=2π∫fidt
Substitute, fi value in the above equation.

θi(t)=2π∫ (fc+kfm(t)) dt
⇒θi(t)=2πfct+2πkf∫m(t)dt
Substitute, θi(t) value in the standard equation of angle modulated wave.
s(t)=Accos(2πfct+2πkf ʃ m(t)dt)
This is the equation of FM wave.
If the modulating signal is m(t)=Amcos(2πfmt), then the equation of FM wave
will be
s(t)=Accos(2πfct+βsin(2πfmt))
Where,
β = modulation index =Δf/fm=kfAm/fm
Frequency Deviation is the difference between FM modulated frequency
(instantaneous frequency) and regular carrier frequency. It is represented
by the letter f, which equals the product of kf and Am.

Code:
clc;
Am=10;
fm=200;
Ac=20;
fc=3000;
t=0.01;
B=8;
t1=linspace(0,t,1000);
mt=Am*sin(2*pi*fm*t1);
ct=Ac*sin(2*pi*fc*t1);
st=Ac*cos(2*pi*fc*t1 + B*sin(2*pi*fm*t1));
Page Number-28

subplot(3,1,1);
plot(t1,mt);
xlabel('Time');
ylabel('Amplitude');
title('Message signal');
subplot(3,1,2);
plot(t1,ct);
xlabel('Time');
ylabel('Amplitude');
title('Carrier signal');
subplot(3,1,3);
plot(t1,st);
xlabel('Time');
ylabel('Amplitude');
title('FM signal');

Output:

Conclusion: MATLAB was used to generate the frequency modulated signal.

You might also like