Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi, I just wrote this Matlab code, but it just showing errors.Could u help me to check it ? computeArea The area of a triangle
Hi, I just wrote this Matlab code, but it just showing errors.Could u help me to check it ?
computeArea The area of a triangle is given by: area Vs x (s -a) x (s -b) x (s-c .t where a, b and c are the lengths of the sides of the triangle, and s is equal to half the sum of lengths of the three sides of the triangle. Write a function computeArea that computes the area of the triangle given the coordinates of the three points that define the triangle. function acomputeArea(x1,y1,x2,y2,x3,y3) Inputs: x1,y1- coordinates of the first point x2, y2- coordinates of the second point x3, y3-coordinates of the third point Output a area of the triangle a - area of the triangle Note: This function must call the computeDistance function to compute the distance between two points. You may assume the function is ready for use (provided as part of this question) with the signature: function d-computeDistance(x1,yl,x2,y2) Your Function ave ResetMATLAB Documentation 1 function a - computeArea(x1,y1,x2,y2,x3,y3) 2% This function computes the area of a triangle given the coordinates of the three points that form the triangle 3% Inputs: 4% x1,y1 - coordinates of the first point 5 % x2,y2-coordinates of the second point 6% x3,y3-coordinates of the third point 71% Output: 8 % a-area of the triangle points x1.y, x2,y2, x3,y3 as the corners given by 9% the equation sqrt (s*(s-a)*(s-b)*(s-c)) where s- (a + b + c)/2; 121% write your function here 14 a computeDistance(x1,x2,y1,y2) 15 b-computeDistance(x2,x3,y2,y3) 16 c computeDistance(x1,x3,yl,y3) 17 s(a+ b c)/2; 18 area sqrt (s*(s-a)*(s-b)(s-c)); 19 endStep 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