Hot to rotate pdegplot about Z, X, or Y axis?

20 ビュー (過去 30 日間)
Baisseyev Miram
Baisseyev Miram 2018 年 11 月 28 日
編集済み: Shantanu Dixit 2025 年 3 月 27 日
Hi, i imported stl model by using pdegplot comand, and want to ask is it possible to rotate it about z, x, or y axises? https://www.mathworks.com/help/pde/ug/stl-file-import.html here is example of stl file importing

回答 (1 件)

Shantanu Dixit
Shantanu Dixit 2025 年 3 月 27 日
編集済み: Shantanu Dixit 2025 年 3 月 27 日
Hi Baisseyev,
If I understood your query correctly, you want to rotate the visualization of your STL model. You can achieve this using the 'view': https://in.mathworks.com/help/matlab/ref/view.html function in MATLAB, which allows to change the azimuth (horizontal rotation) and elevation (vertical rotation) angles without altering the actual model. Below is an example that displays a particular model from three different perspectives:
model = createpde();
importGeometry(model, 'MotherboardFragment1.stl');
figure;
% First subplot: Default top-down view
subplot(1,3,1);
pdegplot(model);
title('Top-Down View');
axis equal;
view([0, 90]); % Top-down view
% Second subplot: Rotated view (45° Azimuth, 30° Elevation)
subplot(1,3,2);
pdegplot(model);
title('Angled View (Az=45, El=30)');
axis equal;
view([45, 30]); % Custom rotation
% Third subplot: Side view (90° Azimuth, 0° Elevation)
subplot(1,3,3);
pdegplot(model);
title('Side View');
axis equal;
view([90, 0]); % Side view
If the actual geometry needs to be rotated rather than just changing the viewpoint, you can apply a rotation matrix to transform the model’s coordinates and use the rotated nodes to plot the figure using functions like 'trisurf': https://in.mathworks.com/help/matlab/ref/trisurf.html
Hope this helps!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by