Question
MATLAB NEEDED. Triangle Function Given the following equations for triangles: sin A a = sin B b = sin C c Law of sines: The
MATLAB NEEDED.
Triangle Function
Given the following equations for triangles:
sin A a | = | sin B b | = | sin C c |
Law of sines:
The law of cosines: c2 = a2 + b2 2ab cos C
a2 = b2 + c2 2bc cos A
b2 = a2 + c2 2ac cos B.
Herons formula for Area: (s(s-a)(s-b)(s-c))^1/2
Where s is the perimeter, called semi perimeter.
Requirements:
1. Write a Matlab function that cycles, like my Demo script. Utilize a Switch Case statement to allow the user to choose one of the below three ways to describe a triangle. Use one Case per choice with the catch all otherwise for errant inputs. The code for each case should ask the user to input the specific parameters for the specific triangle description below. Then in the first two cases of the switch the code should call a unique function that will take the specific data for that case and compute the perimeter and area of the triangle, returning those values. The third case is trivial, because of Herons formula, so it immediately yields perimeter and area, no function call needed. Therefore you will have two unique functions to write.
By the way one extra case could be the loop control, not required.
There are 3 ways to describe any triangle:
Side Angle Side
Angle Side Angle
Side Side Side.
2. For each of these three descriptions ask the user for the correct parameters, e.g. Side, Angle, and Side. Then call an embedded function that uses these 3 parameter and returns the Area and Perimeter for the SAS and ASA methods. For SSS no function is required.
NOTE: You will need to call the appropriate Trig functions to accomplish this task.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started