Calculate volume encapsuled by two surfaces

7 次查看(过去 30 天)
Hey guys,
I have following problem: I need to calculate the volume that is encapsuled by two surfaces (see pic). I can sample the surface points since it is represented as an sfit.
I tried to use integral2 like this:
fun1 = @(x,y) my_blue_fit(x,y);
fun2 = @(x,y) my_red_fit(x,y);
vol1 = integral2(fun1, -4, 4, -4, 4);
vol2 = integral2(fin2, -4, 4, -4, 4):
vol_total = vol1 - vol2;
However, this is obviously not correct since I only want the encapsuled volume, and not the integral across the whole FOV.
Can anyone help me to get the integral borders right? Thanks in advance!
(P.s.: The volume has an irregular shape, so it doesn't have a circular footprint or smth like that)

采纳的回答

Torsten
Torsten 2022-3-22
编辑:Torsten 2022-3-22
fun = @(x,y) max(fun1(x,y)-fun2(x,y),0);
vol = integral2(fun,-4,4,-4,4)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by