MATLAB: Area of Triangle areaarea of triangletriangle Hello, Is there any function to find the area of any triangle using 3D points in cartesian system, where i have the vertices of the triangle in 3d coordinate? Thanks Best Answer According to Wikipedia:http://en.wikipedia.org/wiki/Triangle#Using_coordinatesx = rand(3,1);y = rand(3,1);z = rand(3,1);fill3(x,y,z,'r')x = x(:)';y = y(:)';z = z(:)';ons = [1 1 1];A = 0.5*sqrt(det([x;y;ons])^2 + det([y;z;ons])^2 + det([z;x;ons])^2)Grzegorz Related SolutionsMATLAB: How to convert a given data in 3D format One of the following:permute(F, [1 3 2])permute(F, [2 1 3])permute(F, [2 3 1])permute(F, [3 1 2])permute(F, [3 2 1]) MATLAB: When i run the script without the fprintf line i get the right answer. however when i apply the fprintf line i get the error “index exceeds matrix dimensions.” how do i fix this? (the functions are in different .m files obviously) Works for me:>> TriangleArea_TestThe area for Test Case 1 is: 1.00Try this:which fprintfMaybe you have a variable named "fprintf" that is shadowing the built-in fprintf function. If so, clear it first.SIDE NOTE: You are going to want to put a newline at the end of your fprintf format. E.g.,fprintf('The area for Test Case 1 is: %3.2f\n', triangleArea) <-- Added the \n Related QuestionArea of a triangleIsosurface in cylindrical coordinatesHow to surfplot from xyz coordinates
Best Answer