Why the sum is different to real data?

Hi I have a doubt about, how matlab SUM values, maybe is quite easy for you answer this, but I have an issue based on the following: 1-I have real data about Power Consumption in a Buiding and in average that facility consumes 1740.48 e3 kW per day 2-I load the above data in my simulation based in Photovoltaic generation and I ran it for a day (3600seconds*24hours) 3-I extract the IL(intensity consumed by load) and VL (voltage on the load) from blocks "to file", I apply a simply multiplication 4-In order to find out the consumption during that period of time (24 hours), I apply the function "sum(PL)" and I receive a very large value, that is very uncomprehensible because is around of GW, when it should be kW per day. For me is hard to accept that value, that's why I give up to find an answer to that, please give me a hand in order to get the right value.

4 commentaires

KL
KL le 10 Mai 2017
well, you've written 1740.48e3 kW which is actually 1.74 GW, is it a typo? I have'nt checked your attchment yet.
John D'Errico
John D'Errico le 10 Mai 2017
Modifié(e) : John D'Errico le 10 Mai 2017
This is not a problem with how MATLAB does a sum. Summation is correct. That is a fact, proven millions of times.
The issue is you need to CAREFULLY go through your code. Debug it slowly and carefully. Check each line for correctness. Verify that each variable contains what you expect it to be.
Your problem happens all the time. Someone does some computations, then sees something confusing. The thing is, they did the computations with the wrong variables, or with typos in their code, whatever. Or they simply made a blatant error in some assumption.
Whatever you did, we cannot know, since you have only provided a vague description of what you did. Did you REALLY do exactly as you say? Apparently, you did something wrong! Even you know that to be true. So we cannot know what you did wrong, or how to correct it, unless you actually show the code.
Jayaram Theegala
Jayaram Theegala le 12 Mai 2017
Also, can you attach a sample MATLAB script that shows the issue you are facing?
Jan
Jan le 13 Mai 2017
The results are not "bad", but only unexpected. You can be sure, that Matlab calculates the sum exactly. This means, that your expectations do not match the data. Did you see KL's comment?

Connectez-vous pour commenter.

Réponses (0)

Produits

Commenté :

Jan
le 13 Mai 2017

Community Treasure Hunt

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

Start Hunting!

Translated by