Area under a curve using trapz method

조회 수: 10 (최근 30일)
fabian Maritato
fabian Maritato 2017년 4월 12일
댓글: KSSV 2017년 4월 12일
Hello, hope everyone is well. I have combined two graphs together to get a side by side comparison of them and now I am after trying to get the area under the curve using the trapz method for both data sets.
Since my data has positive and negative values, I have trying to use this code to develop a answer but I am unsure if it is correct or not:
Ak = trapz(f2c(10:50)) - trapz([50 90],[f2c(50) f2c(90)]);
Au = trapz(f2u(10:50)) - trapz([50 90],[f2u(50) f2u(90)]);
or is this code more applicable?
Ak = trapz(f2c(10:35)) + trapz(f2c(35:70));
Au = trapz(f2u(10:35)) + trapz(f2u(35:70));
Ak being the uncalibrated set and Au being the uncalibrated set. I would highly appreciate any comments or guidance please. & thank you in advance.
  댓글 수: 5
fabian Maritato
fabian Maritato 2017년 4월 12일
Thank you. Say, Also if I have two sets of calibrated data sets, say f1c & f2c and want to do a trapz function between those, where the graphs are similar to each other. Would I need to add them together or just:
Ak = trapz([f1c,f2c]);
be the correct way of doing so?
KSSV
KSSV 2017년 4월 12일
Do them separately.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by