Effacer les filtres
Effacer les filtres

How do i calculate the area under curve for 2 curves

4 vues (au cours des 30 derniers jours)
rammah nagi
rammah nagi le 30 Juil 2019
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)');

Réponse acceptée

Star Strider
Star Strider le 30 Juil 2019
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.

Plus de réponses (0)

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by