%%% Eli the Ice Man
%
% /home/dimarzio/Documents/working/12229/lectures/eli.m
% Fri Oct 20 14:48:49 2017
%
% Eli the Ice Man...
%
%
%
%% Setup
f=60;  % Hz
dt=1/6000; % Lots of points per cycle
tmax=1/12; % 1/12 second is 5 cycles

%% Eli
L=1; % Henries
t=[dt:dt:tmax]; 
ireal=5e-3*cos(2*pi*f*t);
vreall=5e-3*2*pi*f*L*cos(2*pi*f*t+pi/2);
figure;plot(t*1000,ireal*1e3,t*1000,vreall);grid on;
xlabel('t, Time, ms');ylabel('i, mA (blue) and V, volts (red)');
title('ELI (Voltage on L Before Current)');

%% Ice
C=1e-6;
ireal=5e-3*cos(2*pi*f*t);
vrealc=5e-3/(2*pi*f*C)*cos(2*pi*f*t-pi/2);
figure;plot(t*1000,ireal*1e3,t*1000,vrealc);grid on;
xlabel('t, Time, ms');ylabel('i, mA (blue) and V, volts (red)');
title('ICE (Current on C Before Voltage)');
