How do I rotate a radial vector around a unit circle and plot each position?
Show older comments
I have a vector consisting of m points, or three (x, y)-coordinate pairs. For instance, the x-coordinate are all zero, so the vector points in the y-direction. I want to rotate this vector n times around the unit circle and store each result in a new matrix of size (mxn)x2 matrix. This is what I have so far, but I have hard-coded m = 3:
clear
clc
clf
n=10;
AngRot=-360/n;
Am=[cosd(AngRot) sind(AngRot);...
-sind(AngRot) cosd(AngRot)];%rotation matrix
x1=[0 0 0]';
y1=[1 1.1 1.2]';
xy1=[x1 y1]
xy2=xy1*Am
x2=xy2(:,1);
y2=xy2(:,2);
xy3=xy2*Am
x3=xy3(:,1);
y3=xy3(:,2);
ang=linspace(0,360,100);
xc=cosd(ang);
yc=sind(ang);
plot(x1,y1,x2,y2,x3, y3,xc,yc)
grid on
axis equal;
Here is what it generates. I'm not sure how to automate it to fill in all the rotations or save the results.

Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!