I am working in MATLAB and I have 2 arrays. Current and Voltage flowing in a capacitance when I connect and disconnect it from the voltage. Of course I have a time_stamp
vector in which there are all the samples of time at which I made the measurements.
I want to plot the power and energy associated to those arrays.
For the power I just need to do:
z1 = plot(time_stamp_ms,measured_voltage.*current,'-b','LineWidth',1);
Right?
Instead, how can I do to plot the energy?
Thanks for your time.
I think your power looks right. For energy, it's just power multiplied by time right so:
dt = diff(time_stamp_ms);
power = measured_voltage.*current;
energy = dt.*power(2:end);
well this gives the energy used between each time step. If you wanted the cumulative energy then:
energy_cum = cumsum(energy)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.