classUnderlying
Description
returns the name of the class of the parts of the quaternion
underlyingClass
= classUnderlying(quat
)quat
.
Examples
Get Underlying Class of Quaternion
A quaternion is a four-part hyper-complex number used in three-dimensional representations. The four parts of the quaternion are of data type single
or double
.
Create two quaternions, one with an underlying data type of single
, and one with an underlying data type of double
. Verify the underlying data types by calling classUnderlying
on the quaternions.
qSingle = quaternion(single([1,2,3,4]))
qSingle = quaternion
1 + 2i + 3j + 4k
classUnderlying(qSingle)
ans = 'single'
qDouble = quaternion([1,2,3,4])
qDouble = quaternion
1 + 2i + 3j + 4k
classUnderlying(qDouble)
ans = 'double'
You can separate quaternions into their parts using the parts
function. Verify the parts of each quaternion are the correct data type. Recall that double
is the default MATLAB® type.
[aS,bS,cS,dS] = parts(qSingle)
aS = single
1
bS = single
2
cS = single
3
dS = single
4
[aD,bD,cD,dD] = parts(qDouble)
aD = 1
bD = 2
cD = 3
dD = 4
Quaternions follow the same implicit casting rules as other data types in MATLAB. That is, a quaternion with underlying data type single
that is combined with a quaternion with underlying data type double
results in a quaternion with underlying data type single
. Multiply qDouble
and qSingle
and verify the resulting underlying data type is single
.
q = qDouble*qSingle; classUnderlying(q)
ans = 'single'
Input Arguments
quat
— Quaternion to investigate
quaternion
object | array of quaternion
objects
Quaternion to investigate, specified as a quaternion
object or an array of quaternion
objects of any dimensionality.
Output Arguments
underlyingClass
— Underlying class of quaternion object
'single'
| 'double'
Underlying class of quaternion, returned as the character vector
'single'
or 'double'
.
Data Types: char
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2020a
See Also
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)