1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Creating two points in matlab

  1. Nov 13, 2013 #1
    1. The problem statement, all variables and given/known data
    i had some problem with matlab of how to create two points of random positions and adding another few random points


    2. Relevant equations
    how to create the points, set a point as the centre, make the iteration for one point to rotate the centre and also the other iterations for the rest of the points to rotate each other
     
  2. jcsd
  3. Nov 15, 2013 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    To set random points use the rand or randn functions.
    The other operations are translation and rotations - there are matrixes for those.

    i.e. 5 3D points at random would be X=rand(3,5) - each column being the coordinates of a point.
    The first data point, for eg, is x1=X(:,1)

    For a translation T, just do X=T*X
    For a rotation R, just do X=R*X

    ... look up translation and rotation matrixes to see how to make them.
    http://en.wikipedia.org/wiki/Transformation_matrix
    http://en.wikipedia.org/wiki/Translation_(geometry [Broken])

    Note: matlab has a lot of built infunctions, why not look through the documentation?
     
    Last edited by a moderator: May 6, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Creating two points in matlab
Loading...