Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Mathlab The distance (d) between any two points P1=(x1,y1) and P2=(x2,y2) is given by: d=(x1x2)2+(y1y2)2 The area of a triangle is area=s(sa)(sb)(sc) Where a,b and
Mathlab
The distance (d) between any two points P1=(x1,y1) and P2=(x2,y2) is given by: d=(x1x2)2+(y1y2)2 The area of a triangle is area=s(sa)(sb)(sc) Where a,b and c are the lengths of the sides of the triangle, and s is equal to half the sum of the length of the three sides of the triangle (i.e. s=0.5(a+b+c) ). 1) Write a function .m file that can be used to calculate the distance between two points Pa, and Pb. function d=distance(pa,pb) 2) Write a script that will calculate the sides of a triangle and its area. - Prompts the user to enter the coordinates of three points (P1, P2 and P3) that determine a triangle (i.e. the x and y coordinates of each point). - Plots the triangle in xy plane. - Uses function distance to calculate the lengths of three sides (a,b and c) of the triangle. - Calculates area of the triangle according to the formula. - Prints the results like: "P1 =[1.00,1.00],P2=[4.00,1.00] and P3=[1.00,5.00] The lengths of three sides 3.000,5.000 and 4.000 The area of triangle is 6.000 " 3) Test the data P1=[2.51,4.763],P2=[10.654,0.875] and P3=[1.777,20.4]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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