How can I draw a circle with centre lines and then rotate it?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
quoroy
am 14 Jul. 2017
Bearbeitet: Prashant Arora
am 28 Jul. 2017
I am trying to draw mode shapes of planetary gears, where I have eigenvectors of the form Transpose of[x y u], where 'u' is a rotation coordinate u = radius*theta. The final result I'm looking for is something like the image, where the first state of the gears (represented by circles) can be exactly at it's equilibrium points at the center and with rotation at 0°, and then the red circles represent a translational mode, where the eigenvector only moves in the x and y direction (I can plot this) or rotational mode where the gear rotates by 'u' (I don't know how to plot this) and the center lines of each circle would also rotate or translate to make it more obvious.
First I tried to draw them like a normal circle with a centre and radius , I found lots of examples of how to do this, like:
function h = circle(x,y,r)
hold on
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
yunit = r * sin(th) + y;
h = plot(xunit, yunit);
hold off
Then I found the function
viscircles(centers,radii)
But I don't know if there's a way to draw the center lines inside the circle (could just plot the lines individually and hold on the figure plot?). I basically have tons of data and eigenvectors so I want to find a way to automate the plotting by just putting in the x y u coordinates of the first and second states per gear, in the case of the example image, its a center sun, 4 planets and the carrier.
I'd really appreciate any suggestions, I'm quite new to matlab.
0 Kommentare
Akzeptierte Antwort
Prashant Arora
am 17 Jul. 2017
Bearbeitet: Prashant Arora
am 17 Jul. 2017
You can use the following method to draw lines inside a circle and rotate/translate them.
radius = 5;
center = [10 15];
rotation = pi/3;
translation = [-0.5 -0.6];
rotTForm = [cos(rotation) sin(rotation); -sin(rotation) cos(rotation)];
viscircles(center,radius,'Color','b');
hold on;
%Circle just needs to be translated, as rotation won't have any effect on
%visuals
viscircles(center+translation,radius,'Color','r');
centerLines = center + [0 radius; 0 0; radius 0];
rotatedLines = (centerLines - center)*rotTForm + center + translation;
plot(centerLines(:,1), centerLines(:,2),'-.');
hold on
plot(rotatedLines(:,1), rotatedLines(:,2),'-.');
3 Kommentare
Prashant Arora
am 28 Jul. 2017
Bearbeitet: Prashant Arora
am 28 Jul. 2017
Hi quoroy, You can create two different lines for the cross. Or you can simply replace the code for centerLines defined as:
centerLines = center + radius*[-1 0;0 0;0 1;0 -1;0 0;1 0];
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!