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!
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);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.