0% found this document useful (0 votes)
93 views11 pages

Software Lab Assignment (Ayushi Manoria-0101EC181037)

This document contains the code and outputs from 9 experiments conducted in MATLAB to study and plot different digital modulation techniques. Each experiment has the aim to write a program for a specific signal (e.g. sine, ramp, impulse) or modulation (e.g. AM, FM, PSK). The code, inputs and outputs are presented for each experiment. The document was submitted by Ayushi Manoria (student ID 0101EC181037) to professor Anu Mangal for a software lab assignment.

Uploaded by

eia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views11 pages

Software Lab Assignment (Ayushi Manoria-0101EC181037)

This document contains the code and outputs from 9 experiments conducted in MATLAB to study and plot different digital modulation techniques. Each experiment has the aim to write a program for a specific signal (e.g. sine, ramp, impulse) or modulation (e.g. AM, FM, PSK). The code, inputs and outputs are presented for each experiment. The document was submitted by Ayushi Manoria (student ID 0101EC181037) to professor Anu Mangal for a software lab assignment.

Uploaded by

eia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Software Lab’s Assignment

Submitted To - Prof. Anu Mangal Ma’am


Submitted By - Ayushi Manoria, EC-5A
Enrollment No - 0101EC181037

Experiment-1
Aim- To study and write a program to plot sine signal.
Matlab Code-
x=linspace(0,2*pi,25);
# 0 to 2pi is divided in 25 equidistant points
y=sin(x);
subplot(2,1,1);
plot(x,y,'r');
title('Continuous');
subplot(2,1,2);
stem(x,y);
title('Discrete');

Matlab Output-
Experiment-2
Aim-To study and write a program to plot ramp signal.

Matlab Code-
x=[1 2 3 4];
dtx=-2:1;
#defining discrete time for x,
#from -2 to 1
subplot(2,1,1);
plot(dtx,x,'ro-');
title('Continuous');
subplot(2,1,2);
stem(dtx,x);
title('Discrete');

Matlab Output-
Experiment-3
Aim-To study and write a program to plot impulse signal.
Matlab Code-

n1=input('Lower limit')
n2=input('Upper limit')
x=n1:n2;
y=[x==0];
stem(x,y,);

Matlab Output-

Experiment-4
Aim-To study and write a program to plot amplitude modulation.
Matlab Code-
close all;
m = 1;
Am = 5; %Amp. of modulating signal
fa = 2000; %frequency of modulating signal
Ta = 1/fa;
t = 0:Ta/999:6*Ta;
ym = Am*sin(2*pi*fa*t);
figure(1)
subplot(3,1,1)
plot(t,ym)
title('Modulating Signal') %Carrier signal
Ac = Am/m;
fc = fa*10;
Tc = 1/fc;
yc = Ac*sin(2*pi*fc*t);
subplot(3,1,2)
plot(t,yc)
grid on;
title('Carrier Signal') %AM Modulation
y = Ac + (1+m*sin(2*pi*fa*t)).*sin(2*pi*fc*t);
subplot(3,1,3)
plot(t,y)
title('Amplitude Modulated Signal')
grid on

Matlab Output-
Experiment -5
Aim- To study and write a program to plot Frequency modulation.
Matlab Code-
t=0:0.001:1;
fm=3;
fc=50;
b=10;
x=sin(2*pi*fm*t);
subplot(3,1,1)
plot(t,x)
y=cos(2*pi*fc*t);
subplot(3,1,2)
plot(t,y)

z=(cos((2*pi*fc*t)+(b*x)));
subplot(3,1,3)
plot(t,z)

Matlab Output-
Experiment- 6
Aim-To study and write a program to plot phase modulation.
Matlab Code-
t = 0:0.001:1;
vm = 5 #amplitude of message signal
vc = 5 #amplitude of carrier signal
fm =10 #Enter the message frequency
fc = 100 #Enter the carrier frequency
m = 4 #Enter modulation index
sm = vm*sin(2*pi*fm*t);
subplot(3,1,1);
plot(t,sm);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Message Signal');
grid on;
sc = vc*sin(2*pi*fc*t);
subplot(3,1,2);
plot(t,sc);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('Carrier Signal');
grid on;
y = vc*sin(2*pi*fc*t+m.*sin(2*pi*fm*t));
subplot(3,1,3);
plot(t,y);
xlabel('Time ---->');
ylabel('Amplitude ---->');
title('PM Wave');
grid on;
Matlab Output-
Experiment- 7
Aim-To study and plot ASK modulation.
Matlab Code-
f=0:1/1024:1;
t=0:1/1024:1;
a=10;
for i=1:1025
if f(i)>50/1024 && f(i)<=100/1024
v(i)=i-50;
elseif f(i)>100/1024 && f(i)<150/1024
v(i)=150-i;
else
v(i)=0;
End
end
figure;
plot(f,v)
for i=1:1025
G(i)=0;
for j=1:1025
G(i)=v(j).*cos(i*j*2*pi/1025)+G(i);
end
end
figure;
plot(t,G)
n=0:24=0
n=25:100=A
n=101:1024=0
figure;
plot(n);
Matlab Output-
Experiment- 8
Aim-To study and plot FSK modulation.
Matlab Code-
clc 
close all
clear all 
fc1=input('Enter the freq
of 1st Sine Wave carrier:');
fc2=input('Enter the freq
of 2nd Sine Wave carrier:');
fp=input('Enter the freq
of Periodic Binary pulse (Message):');
amp=input('Enter the 
amplitude (For Both Carrier &
 Binary Pulse Message):');
amp=amp/2;
t=0:0.001:1; 
c1=amp.*sin(2*pi*fc1*t);
c2=amp.*sin(2*pi*fc2*t);
subplot(4,1,1); 
plot(t,c1)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
subplot(4,1,2) 
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;
subplot(4,1,3)
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
for i=0:1000 
    if m(i+1)==0
        mm(i+1)=c2(i+1);
        else
        mm(i+1)=c1(i+1);
    end
end
subplot(4,1,4) 
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')

The following INPUTS GIVEN TO GENERATE FSK


MODULATED WAVE:
Enter the freq of 1st Sine Wave carrier:10
Enter the freq of 2nd Sine Wave carrier:30
Enter the freq of Periodic Binary pulse (Message):5
Enter the amplitude (For Both Carrier & Binary Pulse Message):4

Matlab Output-
Experiment- 9
Aim- To study and plot PSK modulation.
Matlab Code-
clc 
close all 
clear all 
t=0:.001:1; 
% For setting the sampling interval
fc=input('Enter frequency of Carrier Sine wave: ');
fm=input('Enter Message frequency : ');
amp=input('Enter Carrier & Message 
Amplitude(Assuming Both Equal):');
c=amp.*sin(2*pi*fc*t);
% Generating Carrier Sine
subplot(3,1,1) 
%For Plotting The Carrier wave
plot(t,c)
xlabel('Time')
ylabel('Amplitude')
title('Carrier')

m=square(2*pi*fm*t);
% For Plotting Message signal
subplot(3,1,2)
plot(t,m)
xlabel('time')
ylabel('ampmplitude')
title('Message Signal')
% Sine wave multiplied with square wave in order to generate PSK
x=c.*m;
subplot(3,1,3)  % For Plotting PSK (Phase Shift Keyed) signal
plot(t,x)
xlabel('t')
ylabel('y')
title('PSK')
Matlab Output-

INPUTS GIVEN TO GENERATE ASK MODULATED WAVE:


Enter frequency of Carrier Sine wave: 60
Enter Message frequency : 10
Enter The Carrier & Message Amplitude(Assuming Both Equal):3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy