Create Interpolation Fastcat Device
Closed this issue · 0 comments
alex-brinkman commented
Add a new Fastcat Device to implement a interpolation table
YAML Inputs:
- Single Fastcat Signal
- variable-length
domain
array of lengthN
- variable-length
range
arrays of lengthN
- out-of-bounds behavior (to either fault or saturate signal)
Function:
- During initialization, sort the domain and range by domain.
- Evaluate the signal for current timestamp
- find where within the domain this sample lies (e.g.
domain[i] < signal < domain[i+1]
)- If out-of-bounds, fault or saturate signal
- Otherwise, evaluate linear interpolation between [i] and [i+1] something like...
output = (signal - domain[i]) * (range[i+1] - range[i]) / (domain[i+1] - domain[i]) + (range[i])
Consider precomputing the Slope terms.