MATLAB: Need surface area of fsurf between two planes

conesurface area

Please help. I have generated a cone with fsurf, and two planes to model a real-world welding problem.
What I am trying to find is the area of the surface of the cone, but only the area between the two planes. I have spent most of the day looking for ways to solve this, but I was not successful. Please help.
conefun = @(x,y,z0,phi) z0 + sqrt(x.^2 + y.^2)*cotd(phi/2);
direction = [0 1 0];
rotate(fsurf(@(x,y) conefun(x,y,0,90)),direction,45)
axis equal
xlim([-1 1.5])
ylim([-1 1])
zlim([ 0 1.5])
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
hold on
[x y] = meshgrid(-1.5:0.1:1.5);
z = 0.414*x + 0.406;
surf(x,y,z);
[x y] = meshgrid(-1.5:0.1:1.5);
z = 0.414*x + 0.609;
surf(x,y,z);
Thank you very much

Best Answer

<modified>
Hi Erin,
Here is a totally different method, based on the equation for the cone. It finds the surface area of a cone cut by a plane, then subtracts the area under plane 1 from the area under plane 2. In each case the quantity Sbase is the area of the unperturbed cone, from the lowest height where the plane intersects the cone down to the apex. Phi is the cone opening half-angle, 45 degrees in your case.
I have not downloaded SurfaceIntersection so I can't compare results with the previous answer.
% x = z*tan(phi)*cos(theta);
% y = z*tan(phi)*sin(theta);
% dS = dz/cos(phi) * z*tan(phi)*dtheta % surface area element
% z = beta*z*tan(phi)*cos(theta) + z0 % the eqn. of the plane
% z1 = z0/(1+beta*tan(phi)) % min and max z where plane cuts cone
% z2 = z0/(1-beta*tan(phi))
% cos(theta) = (z-z0)./(beta*z*tan(phi)) % limits on theta, to stay under the plane
phi = pi/4;
beta = 0.414;
h = [0.406 0.609];
T = tan(phi)/cos(phi);
S = zeros(1,2);
for k = 1:2
z0 = h(k);
z1 = z0/(1+beta*tan(phi));
z2 = z0/(1-beta*tan(phi));
fun = @(z) 2*z.*acos((z-z0)./(beta*tan(phi)*z)); % modified
Sint = T*integral(fun,z1,z2);
Sbase = pi*T*z1^2;
S(k) = Sint + Sbase;
end
Sfinal = diff(S)