Rotate 3D surface matrices

1 回表示 (過去 30 日間)
Gifari Zulkarnaen
Gifari Zulkarnaen 2020 年 2 月 21 日
コメント済み: Gifari Zulkarnaen 2020 年 2 月 21 日
I have three matrices for surf command: X, Y, Z. I need to rotate the matrices along z-axis by some degrees. I remember there is a matlab command for that (maybe from image processing toolbox), but I can't recall what is it. The command will make the size of matrices larger, with many zero elements in the four corners. Anyone knows what is the rotation command?

採用された回答

darova
darova 2020 年 2 月 21 日
You can manually change data. Just use rotation matrix
a = 15; % angle rotation
R = [cosd(a) sind(a);-sind(a) cosd(a)];
V = R*[X(:) Y(:)]'; % rotate about Z axis
X1 = reshape(V(1,:),size(X)); % new data
Y1 = reshape(V(2,:),size(Y));
surf(X1,Y1,Z);
  1 件のコメント
Gifari Zulkarnaen
Gifari Zulkarnaen 2020 年 2 月 21 日
I found the answer: imrotate command
But thanks anyway for the insight.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by