Rotate a 2D plot around a specific point on the plot?
27 views (last 30 days)
Show older comments
Hello, I am trying to rotate an object (a plot of a propeller blade cross-section) around a specific point on the plot.
I was given a large list of coordinates to plot. After plotting these many points, the following is plotted:

Now, I need to rotate this blade by a certain number of degrees around a certain point on the plot, for example (0,0), counter-clockwise.
I need to not do this just once, but 205 times (I will use a loop, obviously), and replot each figure on top of eachother, separated by a certain distance in the Z-Plane, so that the plot looks like a wind turbine blade. How can I achieve this?
0 Comments
Answers (2)
Jim Riggs
on 27 Nov 2018
Edited: Jim Riggs
on 27 Nov 2018
% Given data vectors X and Y.
% Want to rotate the data through angle "ang" about rotation center Xc, Yc
X = [..];
Y = [..];
ang = ..;
% Specify the coordinates of the center of rotation
Xc = 0.25 ; % Rotate about the 1/4 chord point
Yc = 0 ;
% The data is roated in a three-step process
% Step 1) Shift the data to the rotation center
Xs = X - Xc; % shifted data
Ys = Y - Yc;
% Step 2) Rotate the data
Xsr = Xs*cos(ang) + Ys*sin(ang); % shifted and rotated data
Ysr = -Xs*sin(ang) + Ys*cos(ang); %
% Step 3) Un-shift the data (back to the original coordinate system)
Xr = Xsr + Xc; % Rotated data
Yr = Ysr + Yc;
The above three steps can be combined into a single step:
Xr = (X-Xc)*cos(ang) + (Y-Yc)*sin(ang) + Xc;
Yr = -(X-Xc)*sin(ang) + (Y-Yc)*cos(ang) + Yc;
0 Comments
Luna
on 27 Nov 2018
Edited: Luna
on 28 Nov 2018
I think you can easily use rotate function which already manipulates the data. It is different from view.
Here for you I have created a simple line and a figure, with a 10 times for loop.
Each time rotated, plots the manipulated data again with holding on, according to origin.
x = 1:10;
y = randi(10,1,10)
figure;
h = plot(x,y);
for i = 1:10
rotate(h,[0 0],20); % rotate h line, by [0 0] point, with 20 degrees
hold on;
plot(h.XData,h.YData, 'color','b')
end
2 Comments
Luna
on 28 Nov 2018
Yes, it gives something like this, so Ryan can plot his eliptic line (which I don't know its formula) with the same method so hopefully it looks like a turbine blade.
See Also
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!