# rdivide, ./

Element-wise quaternion right division

## Syntax

``C = A./B``

## Description

````C = A./B` performs quaternion element-wise division by dividing each element of quaternion `A` by the corresponding element of quaternion `B`.```

example

## Examples

collapse all

Create a 2-by-1 quaternion array, and divide it element-by-element by a real scalar.

`A = quaternion([1:4;5:8])`
```A = 2x1 quaternion array 1 + 2i + 3j + 4k 5 + 6i + 7j + 8k ```
```B = 2; C = A./B```
```C = 2x1 quaternion array 0.5 + 1i + 1.5j + 2k 2.5 + 3i + 3.5j + 4k ```

Create a 2-by-2 quaternion array, and divide it element-by-element by another 2-by-2 quaternion array.

```q1 = quaternion(magic(4)); A = reshape(q1,2,2)```
```A = 2x2 quaternion array 16 + 2i + 3j + 13k 9 + 7i + 6j + 12k 5 + 11i + 10j + 8k 4 + 14i + 15j + 1k ```
```q2 = quaternion([1:4;3:6;2:5;4:7]); B = reshape(q2,2,2)```
```B = 2x2 quaternion array 1 + 2i + 3j + 4k 2 + 3i + 4j + 5k 3 + 4i + 5j + 6k 4 + 5i + 6j + 7k ```
`C = A./B`
```C = 2x2 quaternion array 2.7 - 0.1i - 2.1j - 1.7k 2.2778 + 0.092593i - 0.46296j - 0.57407k 1.8256 - 0.081395i + 0.45349j - 0.24419k 1.4524 - 0.5i + 1.0238j - 0.2619k ```

## Input Arguments

collapse all

Dividend, 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.

Divisor, 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

collapse all

Result of quaternion division, returned as a `quaternion` object or an array of `quaternion` objects.

## Algorithms

collapse all

### Quaternion Division

Given a quaternion $A={a}_{1}+{a}_{2}\text{i}+{a}_{3}\text{j}+{a}_{4}\text{k}$ and a real scalar p,

`$C=A./p=\frac{{a}_{1}}{p}+\frac{{a}_{2}}{p}\text{i}+\frac{{a}_{3}}{p}\text{j}+\frac{{a}_{4}}{p}\text{k}$`

Note

For a real scalar p, A./p = A.\p.

### Quaternion Division by a Quaternion Scalar

Given two quaternions A and B of compatible sizes,

`$C=A./B=A.*{B}^{-1}=A.*\left(\frac{conj\left(B\right)}{norm{\left(B\right)}^{2}}\right)$`

## Version History

Introduced in R2018b