Matlab Code to calculate total energy consumed in given time.
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SUNIL KUMAR
el 25 de En. de 2023
Comentada: Askic V
el 25 de En. de 2023
Hello MathWorks community.
I am absolutely new to MatLab (just started learning yesterday for a project) so i hope you will tolerate my dumbness.
So i have a file from Current mesuring sensor. Column 1 is time in Seconds. Column 2 is Current measured at that time (not important). Column 3 is Power consumed in watts (important). Now my question is, how to calculate total power consumed in the timeframe of the spreadsheet. if the machie ran for 15 seconds, what was the power consumption.
If i am missing out any info, let me know. Thank you for all the help. excited to learn through problems.
0 comentarios
Respuesta aceptada
Askic V
el 25 de En. de 2023
Energy is just an integral of power over time. You can use cumtrapz function.
This is probably what you need:
A = xlsread('X_F40000.xlsx');
t = A(:,1);
P = A(:,3);
E = cumtrapz(t, P);
plot(t,P)
hold on
plot(t,E)
legend('Power', 'Energy');
2 comentarios
Askic V
el 25 de En. de 2023
Yes, final number for energy consumption is E(end), i.e. last element of E.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!