How to use trapz for area under curve

조회 수: 1 (최근 30일)
Junzhen Liu
Junzhen Liu 2021년 4월 2일
댓글: Sulaymon Eshkabilov 2021년 4월 2일
How do I calcuate the area under orange curve from 0-20.
The orange curve is generated by reva2.
  댓글 수: 1
Matt J
Matt J 2021년 4월 2일
What's wrong with the way that is shown in your code?

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

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 4월 2일
The answer to your exercise is realtively simple:
IND = find(Ua2<=20);
AREA = trapz(Ua2(IND), reva2(IND));
fprintf('The area under the curve within [0, 20] m/s is: %f \n', AREA)
Good luck
  댓글 수: 2
Junzhen Liu
Junzhen Liu 2021년 4월 2일
Thank you so much, you made my day
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 4월 2일
You are welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by