distance
Distance between two states
Description
Examples
Create an SE(3) state space.
space = stateSpaceSE3
space =
stateSpaceSE3 with properties:
Name: 'SE3'
StateBounds: [7×2 double]
NumStateVariables: 7
WeightXYZ: 1
WeightQuaternion: 0.1000
Calculate distance between two states.
dist = distance(space,[2 10 3 0.2 0 0 0.8],[0 -2.5 4 0.7 0.3 0 0])
dist = 12.7269
Calculate Euclidean distance between two states.
space.WeightQuaternion = 0; distEuc = distance(space,[2 10 3 0.2 0 0 0.8; 4 5 2 1 2 4 2],[62 5 33 0.2 0 0 0.8; 9 9 3 3 1 3.1 7])
distEuc = 2×1
67.2681
6.4807
Input Arguments
State space object, specified as a stateSpaceSE2,
stateSpaceSE3,
stateSpaceDubins, or stateSpaceReedsShepp object.
Initial states for distance calculation, specified as an n-by-3 or n-by-7 matrix of real values. n is the number of specified states.
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 a state in the state space.
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 a state in the state space.
The function supports following combinations for distance calculation:
n-to-n — n number of states in
states1and n number of states instates2.For example,
distance(space,rand(10,7),rand(10,7))1-to-n — 1 state in
states1and n number of states instates2.For example,
distance(space,rand(1,7),rand(10,7))n-to-1 — n number of states in
states1and 1 state instates2.For example,
distance(space,rand(10,7),rand(1,7))
Data Types: single | double
Final states for distance calculation, specified as an n-by-3 or n-by-7 matrix of real values. n is the number of specified states.
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 a state in the state space.
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 a state in the state space.
The function supports following combinations for distance calculation:
n-to-n — n number of states in
states1and n number of states instates2.For example,
distance(space,rand(10,7),rand(10,7))1-to-n — 1 state in
states1and n number of states instates2.For example,
distance(space,rand(1,7),rand(10,7))n-to-1 — n number of states in
states1and 1 state instates2.For example,
distance(space,rand(10,7),rand(1,7))
Data Types: single | double
Output Arguments
Distance between states, returned as an n-element column vector. n is the number of specified states.
The function supports following combinations for distance calculation:
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)