フィルターのクリア

Area under a plot (Integral)

14 ビュー (過去 30 日間)
Hissam Aziz
Hissam Aziz 2013 年 3 月 29 日
Hi Everyone,
i have a plot which looks like this:<<http://www.tiikoni.com/tis/view/?id=f7a4a17>>. I'm trying to figure out the best way to find the area under the curve i.e. the integral. Two solutions come to mind, the simpsons rule or the trapz method.
totalpowerconsumed = trapz(times, power); % gives me a strange answer, it says that the total power consumed it 0.500 exactly, which i find unlikely. The simpsons rule is another method, but im not sure how to do it, it seems like i have to find a function which approximates this plot.
which method would you suggest? and if you pick the simpsons one, can you please help me set it up a bit?
Thank you!

採用された回答

Ilham Hardy
Ilham Hardy 2013 年 3 月 29 日
I think you should use
cumtrapz
instead of
trapz

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2013 年 3 月 29 日
Why don't you trust the output from trapz()? It looks at least feasible to me.
To test it, create some fake data, or add some data to the end of it with a known area of 1 or similar...

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by