00001 %This program calculates the energy of a microwave with a demand of 0 00002 clear; 00003 Poff = 200;%standby power in W 00004 pf = 0.95;%power factor 00005 00006 00007 00008 E(1)=0+0*j;%Energy is initialized at 0 kWh 00009 for n=2:11 00010 E(n)=E(n-1)+Poff/(3600*1000)+j*Poff*sin(acos(pf))/(3600*pf*1000); 00011 end 00012 00013 f=fopen('test_microwave_energy_accumulation.player','w'); 00014 fprintf(f,'2000-01-01 0:00:01,%6.12f+%6.12fj\n',real(E(1)),imag(E(1))); 00015 for i=2:length(E) 00016 fprintf(f,'+1s,%6.12f+%6.12fj\n',real(E(i)),imag(E(i))); 00017 end 00018 fclose(f);