rotation3D

버전 1.0.0 (1.45 KB) 작성자: Amit Chakraborty
This function is a 3-Dimensional Rotation.This program performs the rotation of coordinates of an (x,y,z) figure by any angle.
다운로드 수: 13
업데이트 날짜: 2022/6/13

라이선스 보기

function [xx,yy,zz]=rotation3D(x,y,z,p,ang)
% Author && support : Amit Chakraborty
% This function is 3-Dimensional Rotaion.
% This program performs rotation of coordinates of an (x,y,z) by any angle.
% Any set of (x,y,z) data will be transformed to (xx,yy,zz) in the new rotated coordinates.
% Original and transformed data are plotted in blue and red respectively.
% p =1 ==> rotations around x-axis
% p =2 ==> rotations around y-axis
% p =3 ==> rotations around z-axis
% ang => amount of rotation. Just change with your requriement
%% Starting from below :
ang= deg2rad(ang); % Converting Degree 2 Radian.
% ang= rad2deg(ang); % Converting Radian 2 Degree.
if p==1
xx = x;
yy = y*cos(ang)-z*sin(ang);
zz = z*cos(ang)+y*sin(ang);
elseif p==2
xx = x*cos(ang)+z*sin(ang);
yy = y;
zz = z*cos(ang)-x*sin(ang);
else
xx = x*cos(ang)-y*sin(ang);
yy = y*cos(ang)+x*sin(ang);
zz = z;
end
figure;
plot3(x,y,z);
title('Original Data vs Rotated Data')
hold ;
plot3(xx,yy,zz,'r');
legend('Original','Rotated')
hold off;
end

인용 양식

Amit Chakraborty (2024). rotation3D (https://www.mathworks.com/matlabcentral/fileexchange/113205-rotation3d), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2022a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
도움

도움 받은 파일: rotation

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0