Question: Using MATLAB 3. Write a function M-file called triangles that: takes as input 3 sides (say a, b and c) of a triangle; yields the
Using MATLAB


3. Write a function M-file called triangles that: takes as input 3 sides (say a, b and c) of a triangle; yields the perimeter, say p, and area, say A (using Heron's formula given below) of the triangle as output. Perimeter: p a+ b+C; Heron's formula for Area: A- sqrt(s(s-a)(s-b)(s-c)), where s p/2, the semi-perimeter Cont.' on next page Use the command window to check that your code works for a 3-4-5 right triangle and a 5-12-13 right triangle. (Use A /2 bh in your check for the area.) Note that the check does not have to be part of the function M-file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
