Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab programming 1 Collinearity of Three Points You are going to create a function to test whether 3 points are collinear (lie in a straight

Matlab programming image text in transcribed
1 Collinearity of Three Points You are going to create a function to test whether 3 points are collinear (lie in a straight line). This can be done by evaluating the area of the triangle formed by the points. Create a function with the following header: function [ collinear ] iscollinear( p1, p2, p3 ) where p1 is a 1 x 2 double array storing the x and y coordinates of point 1 p2 is a 1 x 2 double array storing the x and y coordinates of point 2 . p3 is a 1 x 2 double array storing the x and y coordinates of point 3 . collinear is a logical variable returning whether the points are collinear As part of your main function, you must create a sub-function as follows: function [ area ] triArea pi, p2, p3 ) where . pi is a 1 x 2 double array storing the x and y coordinates of point 1 . p2 is a 1 x 2 double array storing the x and y coordinates of point 2 . p3 is a 1x 2 double array storing the x and y coordinates of point 3 . area is the area of the triangle formed by points pl, p2 and p3 Note that for a triangle with vertices (xi, yi), (x2, ya) and (x3, ys), the area is given by 2 where |.] represents the absolute value of the determinant of the quantity inside the parenthesis. Make sure you are accounting for machine round-off errors in your code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago

Question

When would you use one approach, and when would you use another?

Answered: 1 week ago