Rotate Meshgrid 45 Degrees
古いコメントを表示
I want to rotate my meshgrid 45 degrees. How do I do that? I have the following script:
% meshgrid
[x,y] = meshgrid(-50:5:50);
O = zeros(size(x,1)); % z-values to 0
% Plot
figure; mesh(x,y,O);
az = 0; el = 90; view(az, el);
daspect([1 1 1]);
回答 (2 件)
Star Strider
2016 年 5 月 2 日
If I understand correctly what you want to do, just set:
az = 45;
2 件のコメント
Ermin Sehovic
2016 年 5 月 2 日
Star Strider
2016 年 5 月 2 日
See if the rotate function will do what you want, since it’s likely the easiest.
Otherwise, there are three functions that could do what you want: makehgtform, hggroup, and hgtransform. They create the rotation and translation matrix for you. They’re all related.
theta = 45;
x2 = x*cosd(theta) - y*sind(theta);
y2 = x*sind(theta) + y*cosd(theta);
2 件のコメント
Ermin Sehovic
2016 年 5 月 3 日
qilin guo
2021 年 6 月 10 日
Very good answer!!! It helps me a lot! Thank you very much!

カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
