フィルターのクリア

How do i calculate the area under curve for 2 curves

4 ビュー (過去 30 日間)
rammah nagi
rammah nagi 2019 年 7 月 30 日
回答済み: Star Strider 2019 年 7 月 30 日
How do I calculate the area under this curve for both variables? The Jan excel file is also attached.
%%Electrical output
fileName1 = 'Jan.xlsx';
numData1 = xlsread(fileName1);
Apv = 48 * 1.566; % 48=NoPanels 1.566 area of PV per panel
nel=0.238;
syms J
P= Apv*J*nel;
Pout = subs(P,{J},{numData1(2:25,6)'});
%%
hour = (numData1(2:25,4)');
figure (2);
plot(hour,Pout);
Pconsumption = (numData1(2:25,16)');
hold on;
plot(hour,Pconsumption,'r');
hold off
title('Electrical Power Generated vs Electrical Power consumed')
legend('Electrical Power from PV','Power requirement of system');
xlabel('Time of day');
ylabel( 'Power (W)');

採用された回答

Star Strider
Star Strider 2019 年 7 月 30 日
It depends on the result you want. Note that the last values in your vectors are NaN, so that is going to cause problems in your calculations.
I would instead use:
Pout = Apv*nel*numData1(2:24,6);
hour = (numData1(2:24,4));
Pconsumption = (numData1(2:24,16));
For the integrations, try this:
cintPout = cumtrapz(hour, Pout); % Cumulative Integration
intPout = trapz(hour, Pout); % Complete Integration
cintPconsumption = cumtrapz(hour, Pconsumption); % Cumulative Integration
intPconsumption = trapz(hour, Pconsumption); % Complete Integration
Choose the full integration or the cumulative integration (that you can plot) depending on what you want to do.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumbers and Precision についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by