% File: E5_004.M

clear;

fc = 10;
fa = 1;
Ta = 1/fa;
dt = 4*Ta/200;
wc = 2*pi*fc;
wa = 2*pi*fa;

t = 0:dt:4*Ta;

temp1 = zeros(length(t),1);
for (i = 1:1:length(t))
  if (t(i) >= 2*Ta)
    temp1(i) = 1;
  end;
end;
x = cos(wa*t);
x = x(:);

m = 0.5*(1+temp1).*x;
% This is 50% modulation until t=2Ta, then 100% modulation


y = zeros(length(t),1);
y = pulse(y,t,Ta,2*Ta);

j = sqrt(-1);
g = 1 + m;
g = g(:);
phase = exp(j*wc*t);
phase = phase(:);
v = real(g.*phase);

subplot(211);
plot(t,m);
xlabel('t');
ylabel('m(t)');

subplot(212);
plot(t,v,t,abs(g),':');
xlabel('t');
title('v(t) (solid)  |g(t)| (dotted)');
subplot(111);




