0% found this document useful (0 votes)
71 views15 pages

Jibon Sir Matlab

The document contains an index listing 8 experiments related to digital modulation techniques in MATLAB. Each experiment listing includes the name of the experiment, such as "Write and simulate Amplitude Modulation using Matlab", and the program code to simulate the technique in MATLAB. The document provides program code for experiments on amplitude modulation, frequency modulation, amplitude shift keying, frequency shift keying, phase shift keying, pulse amplitude modulation, pulse width modulation, and pulse position modulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views15 pages

Jibon Sir Matlab

The document contains an index listing 8 experiments related to digital modulation techniques in MATLAB. Each experiment listing includes the name of the experiment, such as "Write and simulate Amplitude Modulation using Matlab", and the program code to simulate the technique in MATLAB. The document provides program code for experiments on amplitude modulation, frequency modulation, amplitude shift keying, frequency shift keying, phase shift keying, pulse amplitude modulation, pulse width modulation, and pulse position modulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

INDEX

EX.NO. Name of The Experiment Remarks

01 Write and simulate Amplitude Modulation using Matlab

02 Write and simulate Frequency Modulation using Matlab

03 Write and simulate Amplitude Shift Keying using Matlab.

04 Write and simulate Frequency Shift Keying using Matlab.

05 Write and simulate Phase Shift Keying using Matlab

06 Write and simulate Pulse Amplitude Modulation using Matlab

07 Write and simulate Pulse Width Modulation using Matlab

08 Write and simulate Pulse Position Modulation using Matlab


Experiment no:01
Name of the experiment: Write and simulate Amplitude Modulation using Matlab
Program:
clc;
close all;
clear all;
% Define AM modulation Index
disp(' example: m=1 means 100% modulation');
%m=input(' Enter the value of modulation index (m) = ');
m=1; % for 100% modulation
if (0>m||m>1)
error('m may be less than or equal to one and geter than to zero');
end
%modulating signal generation
Am=5; % Amplitude of modulating signal
fa=2000; % Frequency of modulating signal
Ta=1/fa; % Time period of modulating signal
t=0:Ta/999:6*Ta; % Total time for simulation
ym=Am*sin(2*pi*fa*t); % Eqation of modulating signal
figure(1)
subplot(3,1,1);
plot(t,ym), grid on;% Graphical representation of Modulating signal
title ( ' Modulating Signal ');
xlabel ( ' time(sec) ');
ylabel (' Amplitud(volt) ');
% carrier signal generation
Ac=Am/m;% Amplitude of carrier signal [ where, modulation Index (m)=Am/Ac ]
fc=fa*10;% Frequency of carrier signal
Tc=1/fc;% Time period of carrier signal
yc=Ac*sin(2*pi*fc*t);% Eqation of carrier signal
subplot(3,1,2);
plot(t,yc), grid on;% Graphical representation of carrier signal
title ( ' Carrier Signal ');
xlabel ( ' time(sec) ');
ylabel (' Amplitud(volt) ');
% AM Modulation
y=Ac*(1+m*sin(2*pi*fa*t)).*sin(2*pi*fc*t); % Equation of Amplitude
%modulated signal
subplot(3,1,3);
plot(t,y);% Graphical representation of AM signal
title ( ' Amplitude Modulated signal ');
xlabel ( ' time(sec) ');
ylabel (' Amplitud(volt) ');
grid on;
Command Window:

OUTPUT:
Experiment no:02
Name of the Experiment: Write and simulate Frequency Modulation using
Matlab
Program:
clc
clear all
close all
t = 0:0.001:1; %upto 1000 samples
vm = input('Enter Amplitude (Message) = ');
vc = input('Enter Amplitude (Carrier) = ');
fM = input('Enter Message frequency = ');
fc = input('Enter Carrier frequency = ');
m = input('Enter Modulation Index = ');
msg = vm*sin(2*pi*fM*t);
subplot(3,1,1); %plotting message signal
plot(t,msg);
xlabel('Time');
ylabel('Amplitude');
title('Message ');

carrier = vc*sin(2*pi*fc*t);
subplot(3,1,2); %plotting carrier signal
plot(t,carrier);
xlabel('Time');
ylabel('Amplitude');
title('Carrier Signal');

y = vc*sin(2*pi*fc*t+m.*cos(2*pi*fM*t));
subplot(3,1,3);%plotting FM (Frequency Modulated) signal
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
title('FM Signal');
Command Window:
OUTPUT:

Experiment no:03
Name of The Experiment: Write and simulate Amplitude Shift Keying using
Matlab.
Program:
clc;
close all;
F1=input('Enter the frequency of carrier=');
F2=input('Enter the frequency of pulse=');
A=3;%A=input('enter the amplitude of carrier wave=');%Amplitude
t=0:0.001:1;
x=A.*sin(2*pi*F1*t);%Carrier Sine wave
u=A/2.*square(2*pi*F2*t)+(A/2);%Square wave message
v=x.*u;
subplot(3,1,1);
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
title('Carrier');
grid on;
subplot(3,1,2);
plot(t,u);
xlabel('Time');
ylabel('Amplitude');
title('Square Pulses');
grid on;subplot(3,1,3);
plot(t,v);
xlabel('Time');
ylabel('Amplitude');
title('ASK Signal');
grid on;
Common window:

OUTPUT:
Experiment no:04
Name of The Experiment: Write and simulate Frequency Shift Keying using
Matlab.
Program:
clc %for clearing the command window
close all %for closing all the window except command window
clear all %for deleting all the variables from the memory
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; % For setting the sampling interval
c1=amp.*sin(2*pi*fc1*t);% For Generating 1st Carrier Sine wave
c2=amp.*sin(2*pi*fc2*t);% For Generating 2nd Carrier Sine wave
subplot(4,1,1); %For Plotting The Carrier wave
plot(t,c1)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
subplot(4,1,2) %For Plotting The Carrier wave
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;%For Generating Square wave message
subplot(4,1,3) %For Plotting The Square Binary Pulse (Message)
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
for i=0:1000 %here we are generating the modulated wave
if m(i+1)==0
mm(i+1)=c2(i+1);
else
mm(i+1)=c1(i+1);
end
end
subplot(4,1,4) %For Plotting The Modulated wave
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')
Command Window:

OUTPUT:
Experiment no:05
Name of The Experiment: Write and simulate Phase Shift Keying using Matlab.
Program:
clc %for clearing the command window
close all %for closing all the window except command window
clear all %for deleting all the variables from the memory
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')
Command Window:
OUTPUT:

Experiment no:06
Name of The Experiment: Write and simulate Pulse Amplitude Modulation using
Matlab
Program:
clc;
clear all;
close all;
a = input('Enter the amplitude = ');
f = input('Enter the frequency = ');
t = 0:0.02:2; % for a total of 16 samples
x1 = 1; %generation of an impulse signal
x2 = a*sin(2*pi*f*t); %generation of sine wave
y = x1.*x2; %modulation step
subplot(3,1,1); %for impulse signal plot
stem(x1);
title('Impulse Signal');
xlabel('Time');
ylabel('Amplitude ');
subplot(3,1,2) %for sine wave plot
plot(t,x2);
title('Sine Wave');
xlabel('Time ');
ylabel('Amplitude ');
subplot(3,1,3) %for PAM wave plot
stem(t,y);
title('PAM Wave');
xlabel('Time');
ylabel('Amplitude');
Command Window:

OUTPUT:
Experiment no:07
Name of The Experiment: Write and simulate Pulse Width Modulation using
Matlab
Program:
clc;
clear all;
close all;
t = 0:0.001:1;
fc = input('Enter the frequency of carrier signal (sawtooth) = ');
fm = input('Enter the frequency of message signal (sine) = ');
a = input('Enter the amplitude of carrier signal = ');
b = input('Enter the amplitude of message signal(should be < Carrier) = ');
vc = a.*sawtooth(2*pi*fc*t);
vm = b.*sin(2*pi*fm*t);
n = length(vc);
for i = 1:n
if (vm(i)>=vc(i))
pwm(i) = 1;
else
pwm(i) = 0;
end
end
subplot(3,1,1);
plot(t,vm);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('Message Signal');
grid on;
subplot(3,1,2);
plot(t,vc);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('Carrier Signal');
grid on;
subplot(3,1,3);
plot(t,pwm);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('PWM Signal');
axis([0 1 0 2]);
grid on;
Command Window:

OUTPUT:
Experiment no:08
Name of The Experiment: Write and simulate Pulse Position Modulation using
Matlab
Program:
clc;
clear all;
close all;
fc=1000;
fs=10000;
fm=200;
t=0:1/fs:(2/fm-1/fs);
mt=0.4*sin(2*pi*fm*t)+0.5;
st=modulate(mt,fc,fs,'PPM');
dt=demod(st,fc,fs,'PPM');
figure
subplot(3,1,1);
plot(mt);
title('message signal');
xlabel('timeperiod');
ylabel('amplitude');
axis([0 50 0 1])
subplot(3,1,2);
plot(st);
title('modulated signal');
xlabel('timeperiod');
ylabel('amplitude');
axis([0 500 -0.2 1.2])
subplot(3,1,3);
plot(dt);
title('demodulated signal');
xlabel('timeperiod');
ylabel('amplitude');
axis([0 50 0 1])
output:

You might also like