# &#8226; Define a function r=dist(X,Y) to calculate the distance of one point X to all elements of Y

Discussion in 'MATLAB' started by talgatbek muratbayev, Nov 19, 2010.

1. ### talgatbek muratbayevGuest

Hi,guys. I just started to learn Matlab, and still have a lot of problem. Can anyone give me hint to my problem. I have to find:
• Define a function r=dist(X,Y) to calculate the distance of one point X to all elements of Y
 For 2D cases
 Y can be a 2*n matrix containing coordinates of points , 1st row, x coordinate; 2nd row, y coordinate; n is the number of points.
 Give comments before the definition of the function
I would greatful for any information, thank you in advance!!!

talgatbek muratbayev, Nov 19, 2010

2. ### Wayne KingGuest

Hi, the general rule for helping people with homework assignments is that you show us what you have done to solve the problem. People are very generous here about helping users when they get stuck, but you should show us what you have done.

Wayne

Wayne King, Nov 19, 2010