%% H.W. ASK %%
g=[0 1 1 0 0 0 1 0 1 1];
t=0:2*pi/99:2*pi;
bit=[];
wav=[];
for n=1:length(g)
if g(n)==0;
se=zeros(1,100);
else g(n)==1;
se=5*ones(1,100);
end
c=sin(2*t);
wav=[wav c];
bit=[bit se];
end
ask=bit.*wav;
subplot(3,1,1);
plot(bit,'linewidth',1.5)
title('UNIPOLAR DATA STREAM (MODULATION INPUT)');
axis([0 100*length(g) -6 6]);
grid;
ylabel('amplitude(V)')
xlabel('time(ms)')
subplot(3,1,2);
plot(wav,'linewidth',1.5)
title('CARRIER SINE WAVE (CARRIER INPUT)');
axis([0 100*length(g) -1 1]);
grid;
ylabel('amplitude(V)')
xlabel('time(ms)')
subplot(3,1,3);
plot(ask,'linewidth',1.5)
title('ASK WAVEFORM');
axis([0 100*length(g) -5 5]);
grid;
ylabel('amplitude(V)')
xlabel('time(ms)')