% Prelab 1 - AM Modulation and Demodulation
% EE133

% time variable

t=[0:1/50/30000:2/1000];

wm=2*pi*1000;
wc=2*pi*30000;
Vm=1;
Vc=1;

Vdc=0;

vm=Vdc+Vm*cos(wm*t);
vc=Vc*cos(wc*t);
vmod=vm.*vc;

subplot(2,2,1)
plot(t,vmod)
title('Multiplication of Vm and Vc, Vdc=0')
ylabel('Volts');
xlabel('Time');

%---

Vdc=0.5;

vm=Vdc+Vm*cos(wm*t);
vc=Vc*cos(wc*t);
vmod=vm.*vc;

subplot(2,2,2);
plot(t,vmod)
title('Multiplication of Vm and Vc, Vdc=0.5')
ylabel('Volts');
xlabel('Time');

%---

Vdc=1;

vm=Vdc+Vm*cos(wm*t);
vc=Vc*cos(wc*t);
vmod=vm.*vc;

subplot(2,2,3);
plot(t,vmod)
title('Multiplication of Vm and Vc, Vdc=1.0')
ylabel('Volts');
xlabel('Time');

%---

Vdc=2;

vm=Vdc+Vm*cos(wm*t);
vc=Vc*cos(wc*t);
vmod=vm.*vc;

subplot(2,2,4);
plot(t,vmod)
title('Multiplication of Vm and Vc, Vdc=2.0')
ylabel('Volts');
xlabel('Time');
