How can I draw a circle with centre lines and then rotate it?

5 ビュー (過去 30 日間)
quoroy
quoroy 2017 年 7 月 14 日
編集済み: Prashant Arora 2017 年 7 月 28 日
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.

採用された回答

Prashant Arora
Prashant Arora 2017 年 7 月 17 日
編集済み: Prashant Arora 2017 年 7 月 17 日
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 件のコメント
quoroy
quoroy 2017 年 7 月 28 日
@Prashant Arora how can I draw crosses instead of L type lines, I can't figure out how the [0 radius; 0 0; radius 0]; works, thanks!
Prashant Arora
Prashant Arora 2017 年 7 月 28 日
編集済み: Prashant Arora 2017 年 7 月 28 日
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];

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by