interpolate
Interpolate between states
Description
Examples
Interpolate Between States in SE(2)
Create an SE(2) state space with default properties.
space = stateSpaceSE2
space = stateSpaceSE2 with properties: Name: 'SE2' StateBounds: [3x2 double] NumStateVariables: 3 WeightXY: 1 WeightTheta: 0.1000
Create a pair of states in 2-D space.
state1 = [2 10 -pi]; state2 = [0 -2.5 -pi/4];
Interpolate halfway between two states.
state = interpolate(space,state1,state2,0.5)
state = 1×3
1.0000 3.7500 -1.9635
Interpolate multiple points with a fixed interval.
states = interpolate(space,state1,state2,0:0.02:1)
states = 51×3
2.0000 10.0000 -3.1416
1.9600 9.7500 -3.0945
1.9200 9.5000 -3.0473
1.8800 9.2500 -3.0002
1.8400 9.0000 -2.9531
1.8000 8.7500 -2.9060
1.7600 8.5000 -2.8588
1.7200 8.2500 -2.8117
1.6800 8.0000 -2.7646
1.6400 7.7500 -2.7175
⋮
Interpolate Between States in SE(3)
Create an SE(3) state space with default properties.
space = stateSpaceSE3
space = stateSpaceSE3 with properties: Name: 'SE3' StateBounds: [7x2 double] NumStateVariables: 7 WeightXYZ: 1 WeightQuaternion: 0.1000
Create a pair of states in 3-D space.
state1 = [2 10 3 0.2 0 0 0.8]; state2 = [0 -2.5 4 0.7 0.3 0 0];
Interpolate halfway between two states.
state = interpolate(space,state1,state2,0.5)
state = 1×7
1.0000 3.7500 3.5000 0.7428 0.2519 0 0.6203
Interpolate multiple points with a fixed interval.
states = interpolate(space,state1,state2,0:0.02:1)
states = 51×7
2.0000 10.0000 3.0000 0.2425 0 0 0.9701
1.9600 9.7500 3.0200 0.2663 0.0109 0 0.9638
1.9200 9.5000 3.0400 0.2899 0.0217 0 0.9568
1.8800 9.2500 3.0600 0.3133 0.0326 0 0.9491
1.8400 9.0000 3.0800 0.3365 0.0434 0 0.9407
1.8000 8.7500 3.1000 0.3594 0.0542 0 0.9316
1.7600 8.5000 3.1200 0.3821 0.0650 0 0.9218
1.7200 8.2500 3.1400 0.4045 0.0757 0 0.9114
1.6800 8.0000 3.1600 0.4266 0.0864 0 0.9003
1.6400 7.7500 3.1800 0.4484 0.0969 0 0.8886
⋮
Input Arguments
space
— State space object
stateSpaceSE2
object | stateSpaceSE3
object | stateSpaceDubins
object | stateSpaceReedsShepp
object
State space object, specified as a stateSpaceSE2
,
stateSpaceSE3
,
stateSpaceDubins
, or stateSpaceReedsShepp
object.
state1
— Start state for interpolation
three-element vector of real values | seven-element vector of real values
Start state for interpolation, specified as a three-element or seven-element vector of real values.
For the 2-D state space objects stateSpaceSE2
,
stateSpaceDubins
, and stateSpaceReedsShepp
, the state is a vector of form [x y
theta]
, which defines the xy-position and orientation
angle theta
of a state in the state space.
For the 3-D state space object stateSpaceSE3
,
the state is a vector of form [x y z qw qx qy qz]
, which defines the
xyz-position and quaternion orientation [qw qx qy
qz]
of a state in the state space.
Data Types: single
| double
state2
— End state for interpolation
three-element vector of real values | seven-element vector of real values
End state for interpolation, specified as a three-element or seven-element vector of real values.
For the 2-D state space objects stateSpaceSE2
,
stateSpaceDubins
, and stateSpaceReedsShepp
, the state is a vector of form [x y
theta]
, which defines the xy-position and orientation
angle theta
of a state in the state space.
For the 3-D state space object stateSpaceSE3
,
the state is a vector of form [x y z qw qx qy qz]
, which defines the
xyz-position and quaternion orientation [qw qx qy
qz]
of a state in the state space.
Data Types: single
| double
ratio
— Interpolation ratio
scalar in range [0, 1] | n-element column vector of values in the range [0, 1]
Interpolation ratio, specified as a scalar in the range of [0, 1], or an n-element column vector of values in the range [0, 1]. n is the number of desired interpolation points.
Data Types: single
| double
Output Arguments
interpStates
— Interpolated states
n-by-3 matrix of real values | n-by-7 matrix of real values
Interpolated states, returned as an n-by-3 or
n-by-7 matrix of real values. n is the number of
interpolation points specified by the ratio
input argument.
For the 2-D state space objects stateSpaceSE2
,
stateSpaceDubins
, and stateSpaceReedsShepp
, each row is of form [x y theta]
,
which defines the xy-position and orientation angle
theta
of the interpolated states.
For the 3-D state space object stateSpaceSE3
,
each row is of form [x y z qw qx qy qz]
, which defines the
xyz-position and quaternion orientation [qw qx qy
qz]
of the interpolated states.
Data Types: single
| double
Version History
Introduced in R2019b
See Also
stateSpaceSE2
| stateSpaceSE3
| stateSpaceDubins
| stateSpaceReedsShepp
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 (한국어)