quat2dcm function error message
8 views (last 30 days)
Show older comments
Hello,
I'm new to the use of these types of functions to transform from one reference frame into another and trying to go from a set of quaternions to a DCM reference frame. However, when trying to use any of the axis transformation functions from quaternions, I get the error message below to say 'input elements are not real'. I can, however, convert to euler angles understandably.
I do not understand why the input elements would not be 'real' since they are simply a set of quaternions derived from accelerometer and gyroscope readings.
Any help much appreciated. Thanks in advance.
dcm = quat2dcm(Q);
Error using quatmod (line 19)
Input elements are not real.
Error in quatnormalize (line 19)
qout = q./(quatmod( q )* ones(1,4));
Error in quat2dcm (line 24)
qin = quatnormalize( q );
5 Comments
Walter Roberson
on 28 Aug 2022
Edited: Walter Roberson
on 28 Aug 2022
Please show the output of
whos Q
I don't understand why I am being told the elements aren't real, assuming that the indication there is that they are not 'real numbers'.
Because it gives the same error message if the input is not class double(), and possibly if it is not an N x 4 matrix of double.
Accepted Answer
Walter Roberson
on 30 Aug 2022
Edited: Walter Roberson
on 30 Aug 2022
Input arguments
q: Quaternion, specified as an m-by-4 matrix containing m quaternions. Each element of q must be a real number. double
That means that the function requires an m x 4 array of double. It does not support quaternion objects. The error message is because isdouble() is false for quaternion() class objects.
You must extract the data from your quaternion() objects to use this function.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
