Code covered by the BSD License  

Highlights from
Digital Carrier Modulation

image thumbnail

Digital Carrier Modulation

by

 

This submission contains basics of digital carrier modulation in any basic communication system usin

Digital_modulations.m
clear all
close all
%% This code helps perform digital carrier modulation in communication systems using the techniques of M-ary ASK,PSK,FSK.
% Revision 0.0.1 Date $26/03/2013
% Arnav Goel, BITS Pilani University
%% 4-ary ASK INITIALIZATIONS
t = 0:(0.001/pi):(8/pi); % here the time domain is taken from 0 to 8 in steps of 1e-3
fc = 10; % carrier frequency in Hz
A = 3; %amplitude of the carrier wave
%Here in M-ary Baseband signalling, the levels are chosen to be {+3,+1,-1,-3}
%Sequence whose ASK is needed to be calculated
S = zeros(1,8001);
S(1:2000) = 3*ones(1,2000);
S(2001:4000) = 1*ones(1,2000);
S(4001:6000) = -1*ones(1,2000);
S(6001:8000) = -3*ones(1,2000);
%carrier signal
car = A.*cos(2*pi*fc.*t);
%ASK Modulated
ASK = S.*car;
%% 4-ary ASK PLOTS
grid on
subplot(3,1,1)
plot(S)
title('Sequence')
axis([0 8000 -4 4])

subplot(3,1,2)
plot(car)
title('Carrier')
axis([0 8000 -4 4])

subplot(3,1,3)
plot(ASK)
title('ASK')
axis([0 8000 -14 14])

%% 4-ary FSK INITIALIZATIONS
t = 0:(0.001/pi):(8/pi);
fc1 = 10;
fc2 = 30;
fc3 = 50;
fc4 = 100;
%Here in M-ary Baseband signalling, the levels are chosen to be {+3,+1,-1,-3}
S1 = zeros(1,8001);
S1(1:2000) = 3*ones(1,2000);
S1(2001:4000) = 1*ones(1,2000);
S1(4001:6000) = -1*ones(1,2000);
S1(6001:8000) = -3*ones(1,2000);

%4 independent carrier signals
car1 = A.*cos(2*pi*fc1.*t);
car2 = A.*cos(2*pi*fc2.*t);
car3 = A.*cos(2*pi*fc3.*t);
car4 = A.*cos(2*pi*fc4.*t);
%composite ASK
ASK1 = S(1:2000).*car1(1:2000);
ASK2 = S(2001:4000).*car2(1:2000);
ASK3 = S(4001:6000).*car3(1:2000);
ASK4 = S(6001:8000).*car4(1:2000);
%FSM Modulated signal
FSK = zeros(1,8000);

FSK(1:2000)=ASK1;
FSK(2001:4000)=ASK2;
FSK(4001:6000)=ASK3;
FSK(6001:8000)=ASK4;

%% 4-ary FSK PLOTS
grid on
figure
subplot(6,1,1)
plot(S1)
title('Sequence')
axis([0 8000 -4 4])

subplot(6,1,2)
plot(car1)
title('Carrier 1 with frequency = 10Hz')
axis([0 8000 -4 4])

subplot(6,1,3)
plot(car2)
title('Carrier2 with frequency = 30Hz')
axis([0 8000 -4 4])

subplot(6,1,4)
plot(car3)
title('Carrier3 with frequency = 50Hz')
axis([0 8000 -4 4])

subplot(6,1,5)
plot(car4)
title('Carrier4 with frequency = 100Hz')
axis([0 8000 -4 4])

subplot(6,1,6)
plot(FSK)
title('FSK')


%% 4-ary PSK INITIALIZATIONS
t = 0:(0.001/pi):(8/pi);
fcpsk = 10;
S3 = zeros(1,8001);
S3(1:2000) = 3*ones(1,2000);
S3(2001:4000) = 1*ones(1,2000);
S3(4001:6000) = -1*ones(1,2000);
S3(6001:8000) = -3*ones(1,2000);
A = 6;
carn1 = A.*cos(2*pi*fcpsk.*t);
carn2 = A.*cos(2*pi*fcpsk.*t + (pi/2));
carn3 = A.*cos(2*pi*fcpsk.*t + pi);
carn4 = A.*cos(2*pi*fcpsk.*t + (pi.*1.5));

ASK1 = (1/3).*S3(1:2000).*carn1(1:2000);
ASK2 = S3(2001:4000).*carn2(1:2000);
ASK3 = S3(4001:6000).*carn3(1:2000);
ASK4 = (1/3)*S3(6001:8000).*carn4(1:2000);

%PSK modulated signal
PSK = zeros(1,8000);
PSK(1:2000) =ASK1;
PSK(2001:4000)=ASK2;
PSK(4001:6000)=ASK3;
PSK(6001:8000)=ASK4;

%% 4- ary PSK PLOTS
grid on
figure
subplot(6,1,1)
plot(S3)
title('Sequence')
axis([0 8000 -4 4])

subplot(6,1,2)
plot(carn1)
title('Carrier1 with 0 phase')
axis([0 8000 -6 6])

subplot(6,1,3)
plot(carn2)
title('Carrier2 with pi/2 phase')
axis([0 8000 -6 6])

subplot(6,1,4)
plot(carn3)
title('Carrier3 with pi phase')
axis([0 8000 -6 6])

subplot(6,1,5)
plot(carn4)
title('Carrier4 with 3pi/2 phase')
axis([0 8000 -6 6])

subplot(6,1,6)
plot(PSK)
title('PSK')
axis([0 8000 -6 6])

Contact us