The area of a triangle ABC can be calculated by: A= 1/2 AB x AC where AB

Question:

The area of a triangle ABC can be calculated by:
A= 1/2 AB x AC
where AB is the vector from point A to point B and AC is the vector from point A to point C. Write a user-defined MATLAB function that determines the area of a triangle given its vertices' coordinates. For the function name and arguments, use [Area] = TriArea (A, B, C). The input arguments A, B, and C, are vectors, each with the coordinates of the corresponding vertex. Write the code of TriArea such that it has two subfunctions---one that determines the vectors AB and AC and another that executes the cross product. (If available, use the user-defined functions from Problem 14). The function should work for a triangle in the x-y plane (each vertex is defined by two coordinates) or for a triangle in space (each vertex is defined by three coordinates). Use the function to determine the areas of triangles with the following vertices:
(a) A = (1, 2), B = (10, 3), C = (6, 11)
(b) A = (-1.5, -4.2, -3), B = (-5.1, 6.3, 2), C = (12.1, 0, -0.5)
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: