How can I create and manipulate multiple points in MATLAB?

In summary, the conversation discusses how to create random points and perform translations and rotations in MATLAB. The rand and randn functions can be used to set random points, and translation and rotation can be done using matrixes. The conversation also suggests looking through MATLAB's documentation for more built-in functions.
  • #1
eltrinco
8
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
  • #2
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:

Related to How can I create and manipulate multiple points in MATLAB?

1. How do I create two points in matlab?

To create two points in matlab, you can use the "plot" function. First, define the x and y coordinates for each point. Then, use the plot function with the x and y coordinates as inputs. The points will be plotted on a graph.

2. Can I create more than two points at once in matlab?

Yes, you can create multiple points at once in matlab. You can define the x and y coordinates as vectors, and then use the plot function with the vectors as inputs. This will plot all the points on the same graph.

3. How can I change the color or shape of the points in matlab?

You can use the "plot" function with additional input arguments to change the color, shape, and size of the points. For example, you can use the "Color" argument to specify a color, and the "Marker" argument to change the shape of the points.

4. Is there a way to label the points I create in matlab?

Yes, you can use the "text" function to label the points you create in matlab. This function allows you to specify the coordinates and text for each label. You can also use the "legend" function to create a legend for your points.

5. Can I save the points I create in matlab for future use?

Yes, you can save the points you create in matlab by using the "save" function. This will save the points as a .mat file, which can be loaded and used in future matlab sessions.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
715
Replies
32
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top