Matlab Code to calculate total energy consumed in given time.
49 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Askic V
2023 年 1 月 25 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!