Answered step by step
Verified Expert Solution
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
(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
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