Distance between two points (x1, y1) and (x2, y2) is defined by:
distance = sqrt((x1-x2)^2+(y1-y2)^2)
Write a matlab function computeDistance that computes the distance between two points, with the
following signature.
function d = computeDistance(p1, p2)
Inputs:
p1 - coordinates of the first point as a vector with coordinates [x1 y1]
p2 - coordinates of the second point as a vector with coordinates [x2 y2]
Output:
d - the distance between the two points
1
Expert's answer
2016-09-14T12:40:03-0400
function d = computeDistance(p1, p2) d = sqrt((p1(1)-p2(1))^2+(p1(2)-p2(2))^2);
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment