Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do the following Program in MATLAB Programming: Problem 1: Write a script file (file1.m) that defines the following three points that represents the vertices of

Do the following Program in MATLAB Programming:

image text in transcribed

Problem 1: Write a script file (file1.m) that defines the following three points that represents the vertices of a triangle based off your student ID: ABCDEFG P1 (A,B) .P3 (E,F) 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. Recall, the area of a triangle is one half times the base times the height. Also, the perimeter is the sum of the length of the three sides. If the triangle is a right triangle, the base and height are simply the two shorter lengths of the sides. If the triangle is not a right triangle, Heron's formula can be used for the calculation of the area, A, based on s, the semi- perimeter. The semi-perimeter is just half of the actual perimeter and a, b, and c are the lengths of the three sides. Area(s - a) (s -b)(s - c) Velo-ole-De-) 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. After returning to the script file, write formatted statements giving the Area and Perimeter of the triangle. Additionally, pass out a string, type, to represent whether the triangle is an acute, a right, or an obtuse triangle. Problem 1: Write a script file (file1.m) that defines the following three points that represents the vertices of a triangle based off your student ID: ABCDEFG P1 (A,B) .P3 (E,F) 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. Recall, the area of a triangle is one half times the base times the height. Also, the perimeter is the sum of the length of the three sides. If the triangle is a right triangle, the base and height are simply the two shorter lengths of the sides. If the triangle is not a right triangle, Heron's formula can be used for the calculation of the area, A, based on s, the semi- perimeter. The semi-perimeter is just half of the actual perimeter and a, b, and c are the lengths of the three sides. Area(s - a) (s -b)(s - c) Velo-ole-De-) 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. After returning to the script file, write formatted statements giving the Area and Perimeter of the triangle. Additionally, pass out a string, type, to represent whether the triangle is an acute, a right, or an obtuse triangle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago