Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

THIS IS A MATLAB CODING!!!! ppease help! been stuck for awhile and stuggling to

ID: 3695639 • Letter: T

Question

THIS IS A MATLAB CODING!!!! ppease help! been stuck for awhile and stuggling to figure it out! example coding with explanations would be deeply appriciated!

s just the on gihal teinperature temP 6.8 The area of a triangle whose three vertices are points (x, y).(x2V2), and (x3, y3) (see Figure 6.6) can be found from the equation 4- 1 (6.12) where | is the determinant operation. The area returned will be positive if the points are taken in counterclockwise order and negative if the points are taken in clockwise order. This determinant can be evaluated by hand to produce the following equation Write a function area2d that calculates the area of a triangle, given the three bounding points (xiyi). (x V2) and (x. ys) using Equation (6.13). Then test your function by calculating the area of a triangle bounded by the points (0,0), (10,0), and (15,5).

Explanation / Answer

The function code depend on how pass the input argument.
There are many ways you can pass the input argument.
1) As a 3x2 matrix
2) As three 1x2 matrices(Each 1x2 matrix represent a point)
3) As six values x1,y1,x2,y2,x3,y3.

Here is the code for the 3rd one.

Matlab function:

function a=area2d(x1,y1,x2,y2,x3,y3)
   a=0.5*((x1*(y2-y3))-(x2*(y1-y3))+(x3*(y1-y2)));

Test:

area= area2d(0,0,10,0,15,5);