interpolate
Interpolate between states
Description
Examples
Create an SE(2) state space with default properties.
space = stateSpaceSE2
space =
stateSpaceSE2 with properties:
Name: 'SE2'
StateBounds: [3×2 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
1.6000 7.5000 -2.6704
1.5600 7.2500 -2.6232
1.5200 7.0000 -2.5761
1.4800 6.7500 -2.5290
1.4400 6.5000 -2.4819
⋮
Create an SE(3) state space with default properties.
space = stateSpaceSE3
space =
stateSpaceSE3 with properties:
Name: 'SE3'
StateBounds: [7×2 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
1.6000 7.5000 3.2000 0.4698 0.1075 0 0.8762
1.5600 7.2500 3.2200 0.4909 0.1179 0 0.8632
1.5200 7.0000 3.2400 0.5117 0.1283 0 0.8495
1.4800 6.7500 3.2600 0.5321 0.1385 0 0.8353
1.4400 6.5000 3.2800 0.5521 0.1487 0 0.8204
⋮
Input Arguments
State space object, specified as a stateSpaceSE2,
stateSpaceSE3,
stateSpaceDubins, or stateSpaceReedsShepp object.
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
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
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
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)