How can I create and manipulate multiple points in MATLAB?

  • Thread starter Thread starter eltrinco
  • Start date Start date
  • Tags Tags
    Matlab Points
AI Thread Summary
To create and manipulate multiple points in MATLAB, use the rand or randn functions to generate random coordinates for points. For example, to create five 3D points, the command X=rand(3,5) can be utilized, where each column represents a point's coordinates. To perform translations and rotations, apply transformation matrices, with translation represented as X=T*X and rotation as X=R*X. It is recommended to consult MATLAB's documentation for built-in functions that can simplify these operations. Understanding transformation matrices is essential for effective manipulation of points in MATLAB.
eltrinco
Messages
6
Reaction score
0

Homework Statement


i had some problem with MATLAB of how to create two points of random positions and adding another few random points

Homework 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
 
Physics news on Phys.org
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 )

Note: MATLAB has a lot of built infunctions, why not look through the documentation?
 
Last edited by a moderator:
Back
Top