MATLAB code for Pulse position modulation

Aim: Write MATLAB code for Pulse position modulation

Requirements: PC with MATLAB software

Program:

clc;
clear all;
close all;
fc=1000;
fs=10000;
f=200;
t=0:2/fs:((2/f)-(1/fs));
x=0.4*cos(2*pi*f*t)+0.5;
y=modulate(x,fc,fs,'ppm');
subplot(3,1,1);
plot(x);
title('modulating signal');
subplot(3,1,2);
plot(y);
title('modulated signal');
x_recov=demod(y,fc,fs,'ppm');
subplot(3,1,3);
plot(x_recov);
title('original signal')

Ouput: