ImpulseToFrequency (FPScript)
Transforms an impulse signal or step signal into a frequency signal.
Syntax
ImpulseToFrequency(Signal, [ N = 1 ] [ , SignalType = TYPE_IMPULSE ])
The syntax of the ImpulseToFrequency function consists of the following parts:
Part |
Description |
||||||
---|---|---|---|---|---|---|---|
Signal |
The impulse signal or step signal to be transformed. For the data series, it is assumed that dX equals one. Permitted data structures are data series und signal. All numeric data types are permitted. For complex data types the absolute value is formed. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||
N |
The number of impulses per revolution. Permitted data structures are scalar value. All numeric data types are permitted. The value must be greater than 0. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value 1. |
||||||
SignalType |
The type of input data set. The argument SignalType can have the following values:
If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value TYPE_IMPULSE. |
Remarks
The data type of the result is always 64-bit floating point.
The structure of the result corresponds to that of the argument Signal.
The unit of the result is the same as the reciprocal of the unit of the X component of Signal. An existing step signal is first converted into an impulse signal in TYPE_INCREMENT mode.
The function searches the impulse signal for positive slopes of the impulses. The threshold is placed directly in the center between the maximum and minimum value of the impulse signal. An hysteresis of 20% is used. The instantaneous frequency results from the X difference of neighboring slopes divided by N. To keep the number of values in the result equal to that of Signal, the frequency just calculated is repeated until a new frequency can be calculated.
The following graph shows a sweep signal (with a quadratic convex frequency increase) and the course of the instantaneous frequency, calculated using the algorithm described:
Available in
FlexPro Basic, Professional, Developer Suite
Examples
ImpulseToFrequency(Signal, 6)
Transforms an impulse signal into a frequency signal. Six impulses are assumed per revolution.
ChangeUnit(ImpulseToFrequency(Signal, 4), "1/min")
Transforms an impulse signal with unit into a speed signal with the unit [1/min]. Four impulses are assumed per revolution.
ImpulseToFrequency(Signal, , TYPE_INCREMENT)
Transforms an impulse signal into a frequency signal (assuming one impulse per revolution). The step signal is first transformed into an impulse signal. The Diff function is used to do this.