Calculate volume below a 3D points

조회 수: 14 (최근 30일)
sarah Abdellahi
sarah Abdellahi 2019년 6월 27일
답변: darova 2019년 6월 28일
I have a set of x,y,z numbers and would like to calculate the volume beneath the surface that passes through them. The data(T) is attached. x=T(:,1), y=T(:,2), z=T(:,3).
Can you please help me.
I use the followig code:
x=T(:,1);
y=T(:,2);
z=T(:,3);
plot3(x,y,z,'.')
interpZ = @(xi,yi) griddata(x,y,z,xi,yi) %set up interpolation
vol = quad2d(interpZ,min(x),max(x),min(y),max(y)) %volume should be close to 1
I get a Nan and " Non-finite result. The integration was unsuccessful. Singularity likely."

채택된 답변

darova
darova 2019년 6월 28일
Which volume do you want to calculate? Values of surface are below and above also
img.png Untitle1d.png
I tried rough method: values of Z in each node multiply dx*dy and sum
img1.png
But the result is not close to 1 ( )

추가 답변 (1개)

infinity
infinity 2019년 6월 27일
Hello,
There is a problem with the interpolation function which is not good to give us a smooth fuction. If you plot the "interpZ" function with the data of x and y like this
plot3(x,y,interpZ(x,y))
you will see the function of Z now is not single value function anymore.
To solve your problem, you need to find a nother way to approximate the data. Or, you may refer other methods that use numerical approximate directly on your data, for example,

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by