%Programme to plot the spectrum for bipolar and manchester 
%encoded baseband binary data 

%Written by Andrew Bateman.

%set up figure numbers and location on the screen

figure(1)
close
figure(2)
close
h=figure('position',[90 341 394 369],'color',[1,1,0]);
h=figure('position',[491 341 400 370],'color',[1,1,0]);

%initialise vectors
Xaxis1=[];
Xaxis2=[];
H1=[];
H2=[];


%spectrum of Manchester encoded data signal
for i=1:150;
   H1(i+1)=2*(sin(i/20))/(i/20)*(sin(i/20))/(i/20)*sin(i/20)*sin(i/20);
   Xaxis1(i+1)=i/50;
end

%spectrum of Biploar data signal
for i=1:150;
   H2(i+1)=(sin(i/10))/(i/10)*(sin(i/10))/(i/10);
   Xaxis2(i+1)=i/50;
end



figure(1)
plot(Xaxis1,H1,'-b','linewidth',2)
hold on
%xaxis1=[0,2];
%xaxis2=[0,0];
title('frequency response for Manchester Encoding')


figure(2)
plot(Xaxis2,H2,'-b','linewidth',2)
hold on
%xaxis1=[-0.2,1.5];
%xaxis2=[0,0];
title('impulse response for Bipolar Baseband Data')



