Positionspeed function – Multichannel Systems NeuroExplorer User Manual
Page 259
5.5.8.29. PositionSpeed Function
PositionSpeed Function
Calculates the position speed from X and Y coordinate variables and creates a new continuous
variable.
Syntax
variableReference PositionSpeed(varX, varY, deltaT, smoothRadius)
Parameters
Parameter
Type
Description
varX
variableReference
Reference to the variable.
varY
variableReference
Reference to the variable.
deltaT
double
Time step for speed calculation.
smoothRadius
double
Smooth parameter. See Comments.
Returns
Reference to the new variable
Comments
PositionSpeed operation calculates the scalar speed of a pair of the position variables.
1. First, for each data point of Position variable PosX[T], where T is time, the raw scalar speed is
calculated:
dX = PosX[ T + DeltaT ] - PosX[ T ]
dY = PosY[ T + DeltaT ] - PosY[ T ]
RawScalarSpeed[ T ] = sqrt( dX*dX + dY*dY ) / DeltaT
If there is no data point at time T + DeltaT, a linear interpolation is used to calculate PosX[T + DeltaT]
and PosY[T + DeltaT].
2. Second, RawScalarSpeed is smoothed with the Gaussian filter. The parameters of the filter are
such that the width (in seconds) of the Gaussian curve at half the height is equal to the value of
Smooth parameter. If Smooth = 0, Gaussian filter is not applied.
Usage
NexScript
doc = GetActiveDocument()
doc.speed = PositionSpeed(doc.LED1_X, doc.LED1_Y, 0.1, 0.5)
See Also
Introduction to NexScript Programming
Page 257