Mat lab program to plot the ask modulated wave for a given binary sequence
%program to plot ask modulated wave
clc;clear all;
close all;
f=2;
t=0:(2*pi)/99:2*pi;
g=input('Enter the binary sequence to be modulated ');
bit=[];mod=[];c=[];cp=[];
for i=1:length(g)
if g(i)==0
die=zeros(1,100);
sp=zeros(1,100);
else g(i)==1
die=ones(1,100);
sp=ones(1,100);
end
c=sin(f*t);
bit=[bit die];
mod=[mod c];
cp=[cp sp];
end
ask=cp.*mod;
subplot(2,1,1)
plot(bit);
title('Binary bit pattern');
axis([0 100*length(g) -2.5 2.5])
grid on;
subplot(2,1,2)
plot(ask);
axis([0 100*length(g) -2.5 2.5])
title('ASK modulated signal');
grid on;
Comments
Post a Comment