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

14 次查看(过去 30 天)
[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

采纳的回答

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 CenterFile Exchange 中查找有关 Surface 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