## Syntax

``Rspeed = radialspeed(Pos,V)``
``Rspeed = radialspeed(Pos,V,RefPos)``
``Rspeed = radialspeed(Pos,V,RefPos,RefV)``

## Description

````Rspeed = radialspeed(Pos,V)` returns the radial speed of the given platforms relative to a reference platform. The platforms have positions `Pos` and velocities `V`. The reference platform is stationary and is located at the origin.```

example

````Rspeed = radialspeed(Pos,V,RefPos)` specifies the position of the reference platform.```
````Rspeed = radialspeed(Pos,V,RefPos,RefV)` specifies the velocity of the reference platform.```

## Examples

collapse all

Calculate the radial speed of a target relative to a stationary platform. Assume the target is located at (20,20,0) meters in Cartesian coordinates and is moving with velocity (10,10,0) meters per second. The reference platform is located at (1,1,0).

`rspeed = radialspeed([20; 20; 0],[10; 10; 0],[1; 1; 0])`
```rspeed = -14.1421 ```

Negative radial speed indicates that the target is receding from the platform.

## Input Arguments

collapse all

Positions of platforms, specified as a 3-by-N matrix. Each column specifies a position in the form [x; y; z], in meters.

Example: `[20; 20; 0]`

Data Types: `double`

Velocities of platforms, specified as a 3-by-N matrix. Each column specifies a velocity in the form [x; y; z], in meters per second.

Example: `[10; 10; 0]`

Data Types: `double`

Position of reference platform, specified as a 3-by-1 vector. The vector has the form [x; y; z], in meters.

Example: `[1; 1; 0]`

Data Types: `double`

Velocity of reference platform, specified as a 3-by-1 vector. The vector has the form [x; y; z], in meters per second.

Example: `[1; -1; 0]`

Data Types: `double`

## Output Arguments

collapse all

Radial speed in meters per second, returned as an N-by-1 vector. Each number in the vector represents the radial speed of the corresponding platform. Positive numbers indicate that the platform is approaching the reference platform. Negative numbers indicate that the platform is moving away from the reference platform.

## Version History

Introduced in R2011a