Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) The distance between any two points (x1, y) and (262, y2) is given by: distance V(x1 - x2)2 + (y1 - y2)2 The area

image text in transcribed

(b) The distance between any two points (x1, y) and (262, y2) is given by: distance V(x1 - x2)2 + (y1 - y2)2 The area of a triangle is: area = Vs(s a)(s b)(s c) where a, b and c are the lengths of the sides of the triangle, and s is equal to half the sum of the lengths of the three sides of the triangle: s= (a+b+c). Write a script, triangle.m, that will prompt the user to enter the coordinates of three points that that determine a triangle (i.e., the x and y coordinates of each point). The script will then calculate and print the area of the triangle, along with a plot of the triangle. You will need a distance function, triangle Dist.m, that returns the distance between 2 points. This function will need 4 inputs to perform the calculation (x1, y1, 22, y2). An area function, triangleArea.m, will need to accept 3 side lengths Your script will call the distance function 3 times and the area function once. Use the patch function to plot your triangle. X [21; 22; x3] [Y1; Y2; y3] Y

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago