How to tilt the plot on the right to make it like the one on the left?

 採用された回答

Star Strider
Star Strider 2023 年 3 月 13 日
Tilting it is relatively straightforward with the rotate function —
[X,Y,Z] = peaks(50);
figure
surf(X,Y,Z)
xlabel('X')
ylabel('Y')
zlabel('Z')
shading('interp')
figure
h = surf(X,Y,Z);
xlabel('X')
ylabel('Y')
zlabel('Z')
rotate(h,[-1 0 0], 20)
view(85,10)
shading('interp')
For some reason, rotate is distorting the surface and it shouldn’t. It’s never done that before when I’ve used it. I’m going to submit a Bug Report about it
.

4 件のコメント

Khalil Sabour
Khalil Sabour 2023 年 3 月 13 日
The problem is I had the right plot in the image from a matrix 341x428, so I don't have the X Y Z coordinates to do the rotation.
The ‘X’ and ‘Y’ coordinates are only required to correctly orient the ‘Z’ surface with respect to their respective axes. They are not absolutely required for the plot.
So, for example ...
[X,Y,Z] = peaks(50);
figure
h = surf(Z);
xlabel('X')
ylabel('Y')
zlabel('Z')
rotate(h,[-1 0 0], 20)
view(85,10)
shading('interp')
axis('equal')
... works just as well. (I added the axis call to avoid distortion in the plot. It is not required.)
.
Khalil Sabour
Khalil Sabour 2023 年 3 月 15 日
Thank you, and I have another question, after tilting, how to measure the profile parameters such as Ra, Rz, Rt, etc.?
Star Strider
Star Strider 2023 年 3 月 15 日
I have no idea what those are.
You need to define them and how to calculate them.

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

その他の回答 (1 件)

Cameron
Cameron 2023 年 3 月 13 日
Use the "View" under the plot handle to update this.
[X,Y,Z] = peaks(250);
p = surf(X,Y,Z,'EdgeColor','none');
p.Parent.View = [10 35];

カテゴリ

ヘルプ センター および File Exchange で Line Plots についてさらに検索

製品

リリース

R2020a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by