Calculate Area under Surface

조회 수: 2 (최근 30일)
Detox
Detox 2016년 7월 16일
편집: Thorsten 2016년 7월 18일
Hi guys,
does anybody know how I can calculate the area under the given curve. I already used a horizontal line at approx. 4.58 to limit my desired area with the following code.
area(x1, max(x1, tmp_1), tmp_1, 'EdgeColor', 'none', 'FaceColor', [.7 .7 .7])
Just to check if my area is the one I really want to calculate. My question now is:
With which approach can I calculate the area and generate an output?
Would you do this with
trapz
But I am not sure about the range for trapz? Really appreciate your help!
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 7월 16일
It is not clear that you have a surface? What you show appears to be 2D. For 2D see polyarea()
Detox
Detox 2016년 7월 17일
편집: Detox 2016년 7월 17일
Got your point now. My choice of words was just weird. Meant area! Thanks for pointing that out.

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

답변 (1개)

Thorsten
Thorsten 2016년 7월 18일
편집: Thorsten 2016년 7월 18일
x = 1:60;
y = exp(-0.1*x); % sample data
plot(x,y)
trapz(y) % area under the curve
Note that if the curve is below zero, this part counts as negative area.
trapz(-y)
An if you have sampled your y data every dx, with a dx ~= 1, your area is
trapz(y)*dx

카테고리

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