curve_handling#
Example Usage#
Full Contents:#
- curve_handling.collapseCurves(curv, refcurv, tquery)#
[curv1, curv2, transf] = collapseCurves(curv1, curv2) Optimize for translation of a curve against curv2
- Parameters
curv (
Mx2 numeric) – Curve to be shifted as closely as possible to refcurvrefcurv (
Nx2 numeric) – curve against which the first curv is collapsedtquery (
Q x 1 numeric) – timepoints in fixed (reference) parameterization (t) at which the interpolated, shifted curve is to be evaluated against the reference curve.
- Returns
curv_transf
transf
ssr
- curve_handling.compareCurves(vars, curv1, curv2, tquery)#
Given two curves, interpolate the first in reference to the second and find the sum squared differences betweeen the two curves as a function of a time offset. This can be used to minimize difference between two time offset curves. The second curve should have a shorter domain so that the first curve’s interpolation covers the seconds’ range.
- Parameters
vars (
a vector containing the variables to be minimized) –- vars1float
time to shift curv1 relative to curv2’s t axis to match the two curves
- vars2float
time dilation factor
curv1 (
N x 1 float array) – first column is independent variable t, second is a value f(t)curv1 – first column is independent variable t, second is a value f(t)
tquery (
M x 1 float array) – independent variable values at which to interpolate
- Returns
ssdiff (float) – the sum of the squared differences between curv1(t2) and curv2(t2), where t2 are the timestamps given in curv2
Example usage
————-
NPMitchell 2020