I want to plot3 x y z axis and how it moves as rotation matrix.
Ältere Kommentare anzeigen
hi, i want to plot x y z axis at zero position [0 0 0] .
and plot how it changes as rotation matrix for example like [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1]
but i when i rotate the dot [0 0 0], the x y z axis does not moves together.
please help me!!
1 Kommentar
Angelo Yeo
am 11 Aug. 2023
안녕하세요. 문의하신 내용을 정확하게 파악하지 못하였습니다. 한국어로 작성하시는게 편하시다면 댓글에 한국어로 문의사항을 좀 더 자세하게 작성해 보시겠어요? 다른 한국 사람들이 보고 더 적절한 도움을 드릴 수도 있습니다.
Akzeptierte Antwort
Weitere Antworten (1)
George Abrahams
am 14 Dez. 2023
Hi 동후, you can plot the axes (basis vectors) of the rotation matrix with my plotframe function on File Exchange. When you change the rotation matrix, you can update its position with the UpdateFrame name-value argument, so that it animates. For example:
f = figure;
ax = axes( f, 'DataAspectRatio', [1 1 1], 'View', [37.5 30], ...
'XLim', [-.5 1.1], 'YLim', [-.5 1.1], 'ZLim', [-.5 1.1], ...
'XGrid', 'on', 'YGrid', 'on', 'ZGrid', 'on' );
% Initialise the plot before beginning the animation.
hg = plotframe( Parent=ax );
rotation = 0;
while isgraphics( f )
% Calculate the new rotation matrix.
transformationMatrix = makehgtform( 'axisrotate',[1 1 1], rotation );
rotationMatrix = transformationMatrix(1:3,1:3);
% Update the plot.
plotframe( rotationMatrix, UpdateFrame=hg )
% drawnow is required to force MATLAB to render the updated figure on each loop.
drawnow
rotation = rem( rotation + 0.04, 2 * pi );
end
Kategorien
Mehr zu Graphics Object Properties finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!