필터 지우기
필터 지우기

quaternion does not work in matlab

조회 수: 8 (최근 30일)
Reza Zh
Reza Zh 2023년 10월 12일
이동: Walter Roberson 2023년 10월 12일
I am trying to use rotatepoint and quaternion. when I want to do matlab's example. an error ocurres.
the example is here:
x = 0.5;
y = 0.5;
z = 0;
plot(x,y,"ko")
hold on
axis([-1 1 -1 1])
quat = quaternion([0,0,pi/4; 0,0,-pi/2],"euler","XYZ","point");
rotatedPoint = rotatepoint(quat,[x,y,z])
rotatedPoint = 2×3
-0.0000 0.7071 0 0.5000 -0.5000 0
-------------------------------------------------------------------
this is the error i get:(when using quaternion)
Index exceeds the number of array elements. Index must not exceed 1.
Error in matlabshared.rotations.internal.quaternionBase>partsFromEuler (line 256)
r3 = [arg3(3) arg3(2) arg3(1)];
Error in matlabshared.rotations.internal.quaternionBase>partsFromConversion (line 182)
[qa,qb,qc,qd] = partsFromEuler(arg1,arg2,arg3,arg4);
Error in matlabshared.rotations.internal.quaternionBase (line 59)
[obj.a,obj.b,obj.c,obj.d] = partsFromConversion(varargin{:});
Error in quaternion (line 109)
obj@matlabshared.rotations.internal.quaternionBase(varargin{:});
  댓글 수: 4
Dyuman Joshi
Dyuman Joshi 2023년 10월 12일
편집: Dyuman Joshi 2023년 10월 12일
It could be. Using quaternion() and rotatepoint() requires toolboxes.
MATLAB Online says that one of the following is required for both -
Automated Driving Toolbox
Sensor Fusion and Tracking Toolbox
Navigation Toolbox
Radar Toolbox
Robotics System Toolbox
ROS Toolbox
UAV Toolbox
Computer Vision Toolbox
Check if you have any of the following toolboxes installed by typing "ver" in the command window.
Reza Zh
Reza Zh 2023년 10월 12일
All toolbox mentioned here are installed on my MATLAB 2022a ii

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2023년 10월 12일
이동: Walter Roberson 2023년 10월 12일
As an experiment try
quat = quaternion([0,0,pi/4; 0,0,-pi/2],'euler','XYZ','point');
The R2022a documentation https://www.mathworks.com/help/releases/R2022a/driving/ref/quaternion.html?s_tid=doc_ta shows only using character vectors in those positions, not string objects, so it just might be the case that R2022a does not recognize string objects there.
  댓글 수: 1
Reza Zh
Reza Zh 2023년 10월 12일
이동: Walter Roberson 2023년 10월 12일
it worked by using 'euler','XYZ','point' instead of "euler","XYZ","point"
thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by