# interp

Interpolate between transformations

Since R2022b

## Syntax

``transformation0 = interp(transformation1,transformation2,points)``
``rotation0 = interp(rotation1,rotation2,points)``
``___ = interp(___,transformation2,N)``

## Description

````transformation0 = interp(transformation1,transformation2,points)` interpolates at normalized positions `points` between transformations `transformation1` and `transformation2`.The function interpolates rotations using a quaternion spherical linear interpolation, and linearly interpolates translations.```
````rotation0 = interp(rotation1,rotation2,points)` interpolates at normalized rotations `points` between rotations `rotation1` and `rotation2`.The function interpolates rotations using a quaternion spherical linear interpolation```
````___ = interp(___,transformation2,N)` interpolates `N` steps between the specified transformations or rotations.```

## Input Arguments

collapse all

First transformation, specified as a scalar `se2` object, a scalar `se3` object, or as an N-element array of transformation objects, where N is the total number of transformations. If you specify `transformation1` as an array, each element must be of the same type.

Either `transformation1` or `transformation2` must be a scalar transformation object of the same type. For example, if `transformation1` is an array of `se2` objects, `transformation2` must be a scalar `se2` object.

Last transformation, specified as a scalar `se2` object, a scalar `se3` object, or as an N-element array of transformation objects, where N is the total number of transformations. If you specify `transformation2` as an array, each element must be of the same type.

Either `transformation1` or `transformation2` must be a scalar transformation object of the same type. For example, if `transformation1` is an array of `se2` objects, `transformation2` must be a scalar `se2` object.

First rotation, specified as a scalar `so2` object, a scalar `so3` object, or as an N-element array of rotation objects, where N is the total number of rotations. If you specify `rotation1` as an array, each element must be of the same type.

Either `rotation1` or `rotation2` must be a scalar rotation object of the same type. For example, if `rotation1` is an array of `so2` objects, `rotation2` must be a scalar `so2` object.

Last rotation, specified as a scalar `so2` object, a scalar `so3` object, or as an N-element array of rotation objects, where N is the total number of rotations. If you specify `rotation2` as an array, each element must be of the same type.

Either `rotation1` or `rotation2` must be a scalar rotation object of the same type. For example, if `rotation1` is an array of `se2` objects, `rotation2` must be a scalar `se2` object.

Normalized positions, specified as an N-element row vector of values in the range [`0`, `1`], where N is the total number of interpolated positions. Normalized positions `0` and `1` correspond to the first and last transformations or rotations, respectively.

Example: `interp(tf1,tf2,0.5)` interpolates a transformation halfway between `tf1` and `tf2`.

Example: `interp(r1,r2,0.5)` interpolates a rotation halfway between `r1` and `r2`.

Number of interpolated positions, specified as a positive integer.

Example: `interp(tf1,tf2,5)` interpolates five transformations between transformations `tf1` and `tf2`.

Example: `interp(r1,r2,7)` interpolates seven rotations between rotations `r1` and `r2`.

## Output Arguments

collapse all

Interpolated transformations, returned as an N-by-M matrix of the same transformation type as `transformation1` and `transformation2`, where N is the length of the longer argument between `transformation1` and `transformation2`, and M is the number of interpolated positions. Each row represents an interpolated transformation between `transformation1` and `transformation2`.

Interpolated rotations, returned as an N-by-M matrix of the same rotation type as `rotation1` and `rotation2`, where N is the length of the longer argument between `rotation1` and `rotation2`, and M is the number of interpolated positions. Each row represents an interpolated transformation between `rotation1` and `rotation2`.

## Version History

Introduced in R2022b