Professional Documents
Culture Documents
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.
Experiment 1
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
X(t) =eαt
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.
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
“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.
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:
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)
⇒Amax=Ac+Am
⇒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.
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
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:
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.
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.
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)');
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)');
Output:
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 amplitude is positive, and the phase changes in the opposite direction
when the amplitude is negative.
Mathematical Representation:
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:
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
θ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: