I have a set of numerical data stored in a vector D, and a second vector of positions z, of equal length.
If i wish to calculate the integral shown in the picture, how would this be done?
Equation.png

답변 (2개)

John D'Errico
John D'Errico 2019년 5월 27일

0 개 추천

Multiply the two vectors. Then call trapz.
Star Strider
Star Strider 2019년 5월 27일

0 개 추천

For vectors of data, the best option would be the trapz (link) or the related cumtrapz functions, depending on the result you want.

댓글 수: 1

Abdul Basith Ashraf
Abdul Basith Ashraf 2020년 8월 31일
I have not so regular data (x and y are returned from ode45).
How can I visualize the rectangles under the curve to see how good trapz is doing?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

질문:

2019년 5월 26일

댓글:

2020년 8월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by