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
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)
Step by Step Solution
3.44 Rating (173 Votes )
There are 3 Steps involved in it
Script file clear clc dispPart a A12 B103 C611 Area ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
652-B-F-F-M (734).docx
120 KBs Word File
