For a homework assignment I need to write a MatLab program that plots instantaneous power through a load. It is just a simple ac voltage source V=3cos(15000t) powering a load of Z=270+471.24jΩ. Attached is the output of power that I get and It seems wrong to me. Should it be just a simple sinusoidal wave, or is what I have at all correct? If it is wrong where am I making a mistake? Thank you!!!! My code: trange=30/15000; dt=trange/10000; t=0:dt:trange; V=3*cos(15000*t); Z=270+471.24j; I=V./Z; Mag=abs(I); Phase=angle(I); Iinst=Mag.*cos((15000*t)+Phase); P=Iinst.*V; plot(t,P) The plot:
I don't use Matlab but it could be the 'Phase' term. Since the current phase [lag] is constant, why not simply use Phase=-atan(Imag(Z)/Real(Z))