Question: by using matlab your closestm file will contain the definition...
By using Matlab:
Your closest.m file will contain the definition of a function called closest which takes two vectors, a vector of x coordinates called xs and a vector of y coordinates called ys . We will assume both vectors have the same length, and the two vectors together give the x and y coordinates of a collection of points in the plane. For example, if the points in the plane are (2,3), (7,-1), (5,0), (-1,1), and (0,2) then xs would be the vector [2, 7, 5, -1, 0] and ys would be the vector [3, -1, 0, -1, 2] . Your function should then determine which of the points represented is closets to the origin and should return a vector whose first entry is the x -coordinate of that point and whose second entry is the y -coordinate. Furthermore, your code should work without you having to write any loops or use recursion!
This is what I've done, but something is wrong, the result can't find the closest point. Could u plz help me out? We can't use loops and recursion btw:)