How to find the equation of the curve that intersects a 3D surface and a plane
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello, everyone:
I want to calculate the volume of the solid boundary between the surface and two cubes using integral.
I have read this topic 'How do I find the equation of the line that intersects a 3D surface and a plane passing through 3 points of interest on the surface?' and my idea is therefore to fit a polynomial function of the surface (f(x,y)= z = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2)and the intersection between the top plane of the cube and the surface is curveFun: C = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 and C is the height of the top plane, which is a constant.
This is part of my code:
% to generate the surF, suppose coef are known
zFun = '';
for i=1:np
for j=1:np
P = char(vpa(coef(i,j),40));
if coef(i,j) < 0
Sign = ' ';
else
Sign = ' +';
end
I = num2str(i-1);
J = num2str(j-1);
zFun = [zFun Sign P '*x^' I '*y^' J];
% q = q + 1;
end
end
sym x,y
surF = matlabFunction(sym(zFun));
% to calculate the volume under the surface
vol = quad2d(surF,xleft,xright,downY,upY);
% to calculate the volume between the surface and top plane
fun=@(x,y,z)x.^0+y.^0+z.^0;
q = integral3(fun,xleft,xright,Ydown,CurveFun,C,surF);
To calculate the volume under the surface, I can use double integral, which only need the xmin, xmax, ymin, ymax and surfF.
Now for the volume between the surface and the upper cube, I can use the triple integral or I double integral if I know the curve function. Now, how can I construct the curveFun for this triple integral ? The topic mention I can use the Symbolic Math Toolbox to simplify the curve function but I don't know how.
Also, I 'd like to know if there is a better solution to calculate the volume.
I have tried triangulation and the volume under the surface is the sum of these prisms, but the calculation accuracy is largely depended on the number of points I can have.
Many thanks.
댓글 수: 0
답변 (2개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!