How to integrate this function correctly?

1 回表示 (過去 30 日間)
Danny Helwegen
Danny Helwegen 2019 年 9 月 24 日
回答済み: Fabio Freschi 2019 年 9 月 24 日
Hey,
this seems like a rather simpel problem but I don't seem to get it right.
I'm given the following integral: = and the following dataset:
time = [0 1 2 3 4 5 6 7 8 9 10 12 14]';
E = [0 0.0199867 0.0999334 0.1598934 0.1998668 0.1598934 0.1199201 0.0799467 0.05996 0.0439707 0.02998 0.011992 0]';
Next I used trapz to solve with a result of = 32.2409. However, I know that the correct answer should be ~6.1. What am I doing wrong?
y_sigma = time.^2 .* E;
sigma = trapz(time,y_sigma)
Thanks in advance,
Danny

採用された回答

Fabio Freschi
Fabio Freschi 2019 年 9 月 24 日
I don't see nothing wrong in the result you get. The result is correct also "'by looking" at time-y_sigma graph. My guesses:
  • Are your data correct?
  • you got sigma^2, but maybe you should write
sigma = sqrt(trapz(time,y_sigma)) % 5.7130

その他の回答 (0 件)

カテゴリ

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