minus, -
Quaternion subtraction
Syntax
Description
Examples
Subtract a Quaternion from a Quaternion
Quaternion subtraction is defined as the subtraction of the corresponding parts of each quaternion. Create two quaternions and perform subtraction.
Q1 = quaternion([1,0,-2,7]); Q2 = quaternion([1,2,3,4]); Q1minusQ2 = Q1 - Q2
Q1minusQ2 = quaternion
0 - 2i - 5j + 3k
Subtract a Real Number from a Quaternion
Addition and subtraction of real numbers is defined for quaternions as acting on the real part of the quaternion. Create a quaternion and then subtract 1 from the real part.
Q = quaternion([1,1,1,1])
Q = quaternion
1 + 1i + 1j + 1k
Qminus1 = Q - 1
Qminus1 = quaternion
0 + 1i + 1j + 1k
Input Arguments
A
— Input
quaternion
object | array of quaternion
objects | real scalar | array of real numbers
Input, specified as a quaternion
object, an array of quaternion
objects of any dimensionality, a real scalar, or an array of real numbers of
any dimensionality. Numeric values must be of data type
single
or double
.
A
and B
must have compatible
sizes. In the simplest cases, they can be the same size or one can be a
scalar. Two inputs have compatible sizes if, for every dimension, the
dimension sizes of the inputs are the same or one of the dimensions is
1.
B
— Input
quaternion
object | array of quaternion
objects | real scalar | array of real numbers
Input, specified as a quaternion
object, an array of quaternion
objects of any dimensionality, a real scalar, or an array of real numbers of
any dimensionality. Numeric values must be of data type
single
or double
.
A
and B
must have compatible
sizes. In the simplest cases, they can be the same size or one can be a
scalar. Two inputs have compatible sizes if, for every dimension, the
dimension sizes of the inputs are the same or one of the dimensions is
1.
Output Arguments
C
— Result
quaternion
object | array of quaternion
objects
Result of quaternion subtraction, returned as a
quaternion
object or an array of
quaternion
objects.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2018b
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)