Results 1 to 4 of 4

Math Help - Matlab - Shortest Distance

  1. #1
    Newbie
    Joined
    Mar 2008
    From
    Wellington, New Zealand
    Posts
    1

    Matlab - Shortest Distance

    I have just started to use matlab and I am trying to find the shortest distance from a point P=(8,20) to a plane: v(a,b) = [6,0,0] + a[-2,1-0] + b[-1,0,1]
    So far all I have done is to find the normal vector.
    I know how to do this normally just unsure in matlab - any help would be great.

    Thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by metafolic View Post
    I have just started to use matlab and I am trying to find the shortest distance from a point P=(8,20) to a plane: v(a,b) = [6,0,0] + a[-2,1-0] + b[-1,0,1]
    So far all I have done is to find the normal vector.
    I know how to do this normally just unsure in matlab - any help would be great.

    Thanks
    You might try something like this:

    Code:
    %  NOTES
    %  x*y' is the inner product or dot product of x and y
    %
    
    p=[8,2,0];
    cc=[6,0,0];
    v1=[-2,1,0];
    v2=[-1,0,1];
    
    p=p-cc;  %translate everything so plane goes through origin
    
    u1=v1/sqrt(v1*v1');  %gramm-schmitt orthogonalisation of v1 and v2
    u2=v2-(u1*v2')*u1;
    u2=u2/sqrt(u2*u2');
    
    dd=p-(p*u1')*u1-(p*u2')*u2;     %get component of p normal to the u1, u2 plane
    
    dist=sqrt(dd*dd'); distance of p from the plane
    But I have not checked this as I don't have Matlab or Octave on this machine.

    RonL
    Last edited by CaptainBlack; March 19th 2008 at 02:46 AM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Apr 2008
    Posts
    72

    Massey 160.102 huh...

    same problem..except i dont even know how to find the normal vector
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by deragon999 View Post
    same problem..except i dont even know how to find the normal vector
    Perhaps if you looked at the detail of the proposed code, that might help.

    RonL
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Shortest distance
    Posted in the Calculus Forum
    Replies: 2
    Last Post: June 10th 2009, 09:37 PM
  2. Shortest distance possible...
    Posted in the Calculus Forum
    Replies: 5
    Last Post: November 24th 2008, 10:02 PM
  3. xyz^2=5 shortest distance
    Posted in the Calculus Forum
    Replies: 4
    Last Post: May 27th 2008, 11:34 AM
  4. shortest distance
    Posted in the Pre-Calculus Forum
    Replies: 1
    Last Post: March 16th 2007, 09:10 AM
  5. shortest distance
    Posted in the Math Topics Forum
    Replies: 3
    Last Post: December 18th 2006, 08:48 AM

Search Tags


/mathhelpforum @mathhelpforum