Question: It must be done as a MATLAB code. Problem 1: Write a script file (.m) that defines the following three points that represents the vertices
It must be done as a MATLAB code.
Problem 1: Write a script file (.m) that defines the following three points that represents the vertices of a triangle based off your student ID: ABCDEFG.
P1 = (A,B)
P2 = (C,D)
P3 = (E,F)
If your numbers do not build a triangle (eg A, B is the same as C, D), add one to one of your numbers so that they can make a triangle. Sketching your triangle first is recommended.
After defining these points in the script, call a function, TriangleNew, that inputs the three points and outputs the Area and the Perimeter of the triangle. Herons formula can be used for the calculation of the area, A, based on s, the semi-perimeter. The semi-perimeter is half of the perimeter and a, b, and c are the lengths of the three sides

Within the function, TriangleNew, embed a subfunction, SideLength, that inputs two points and returns the length of the side connecting those two points. Additionally, embed another subfunction, Slope, that inputs two points and returns the slope of the line connecting those two points. Before leaving the TriangleNew function, write to the command window, formatted statements given the lengths (L12, L13, and L23) and slopes (m12, m13, m23) of the three sides of the triangle. Use if/else statements to determine whether the triangle is an acute, a right, or an obtuse triangle. To do so, use the Pythagorean theorem as shown in class. Be sure to make c the longest side length. The sort function may be helpful to determine which side length is the longest. Make a formatted statement saying what type of triangle you have. After returning to the script file, write formatted statements giving the Area and Perimeter of the triangle.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
