Rotating a Cylinder to fit the line x=y=z

45 ビュー (過去 30 日間)
Kevin Hanekom
Kevin Hanekom 2021 年 4 月 7 日
コメント済み: Kevin Hanekom 2021 年 4 月 7 日
[sig_1, sig_2, sig_3] = cylinder;
%sig_3 = sig_3 * 2;
g = surf(sig_1,sig_2,sig_3);
direction =[1 1 1];
rotate(g,direction, 45)
xlabel("x");
ylabel("y");
zlabel("z");
title('Von Mises Yield Surface')
hold on
Q = plot3([0 2], [0 2], [0 2]);
hold off
Hey everyone, I am new to matlab and am trying to figure out how I would be able to rotate a cylinder to fit the line y=x=z, like a von mises surface. Could i use the line as a refrence point for my cylinder? Or am i rotating my surface wrong?
Any help or refrence to a source that might help will be greatly appreciated
  1 件のコメント
KSSV
KSSV 2021 年 4 月 7 日
Get the angle of line and then rotate cyclinder by this angle.

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

採用された回答

DGM
DGM 2021 年 4 月 7 日
The vector you're using is the vector you're trying to align the cylinder to. The vector you need to be specifying is the axis of rotation, which should be orthogonal to [1 1 1]. It also seems that rotate() likes to move the origin around depending on the plot box, so you'll have to make it stop doing that by explicitly specifying a coordinate origin. Lastly, the rotation angle isn't 45 degrees.
clf
[sig_1, sig_2, sig_3] = cylinder;
g = surf(sig_1,sig_2,sig_3);
rotaxis = [135 0]; % i decided to do this polar instead of cart
rotate(g,rotaxis,90-atand(1/sqrt(2)),[0 0 0])
xlabel('x');
ylabel('y');
zlabel('z');
title('Von Mises Yield Surface')
hold on
axis equal
Q = plot3([0 2], [0 2], [0 2]);
Q = plot3([1 -1], [-1 1], [0 0]);
hold off
And like I said, the angle isn't 45. It's easy enough to derive, though.
  1 件のコメント
Kevin Hanekom
Kevin Hanekom 2021 年 4 月 7 日
You are my savior! Thank you for the help!! But yes i see now, theta is = 45 but that doesnt necessarily mean that phi also = 45.
Again, Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by