how can i solve numerically a vector integral?

I have a plot of gaussian alike profile in matlab.
the plot presents the intensity (I) profile( E^2) as a function of location(radius) r.
i need to calculate the integral of I(r)*r*dr which is the area under the graph, i tried solving with trapz but the answer isnt correct, so how can i calculate this integral when
I(r) is a vector and r is a value i know?plot.PNG

5 件のコメント

madhan ravi
madhan ravi 2019 年 1 月 15 日
integral() with arrayvalued option?
Torsten
Torsten 2019 年 1 月 15 日
trapz(r,I.*r) is too inexact ?
Adi
Adi 2019 年 1 月 16 日
The intensity is normalized so i should get area under the graph= 1,
the plot looks like that
plot( r_vector,intensity_vector), so i tried trapz(r_vector,intensity_vector) to get the area under the graph is it correct? for this option the result is 1.7
thank you
Torsten
Torsten 2019 年 1 月 16 日
As I wrote,
trapz(r_vector,r_vector.*intensity_vector)
if you want to approximate
integral(I(r)*r*dr )
Adi
Adi 2019 年 1 月 16 日
thank you!

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

Adi
2019 年 1 月 15 日

コメント済み:

Adi
2019 年 1 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by