Circuit Theory/Phasors/Examples/Example 7/mfile7a
format short R = 10; L = .01; w = 377; Vm = 120*2^.5; omega = 2*pi/3; Im = Vm/(R^2+(L*w)^2)^.5; alpha = omega - atan(L*w/R); syms t; I = Im * cos(w*t+alpha); Vr = R*I; VL = L*diff(I,t); fprintf('I is') vpa(I,3) fprintf('Vr is') vpa(Vr,3) fprintf('VL is') vpa(VL,3) fprintf('checking .. should equal 0') subs(Vr,t,0) + subs(VL,t,0) - Vm*cos(omega)