• 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. 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
    #1
    1. Advertisements

  2. talgatbek muratbayev

    Wayne King Guest

    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
    #2
    1. Advertisements

  3. Hints. meshgrid(), hypot(), bwist, or just a plain old function with the Pythagorean Theorem in it.
     
    Image Analyst, Nov 19, 2010
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.