fwd4()

Contents

fwd4()#

fwd4(states: ndarray, dt: float, inputs=None)[source]#

Fourth-order forward difference for estimating the first derivative.

\[\frac{\textup{d}}{\textup{d}t}\q(t)\bigg|_{t = t_j} \approx \frac{1}{12\delta t}(-25\q(t_j) + 48\q(t_{j+1}) - 36\q(t_{j+2}) + 16\q(t_{j+3}) - 3\q(t_{j+4}))\]

where \(\delta t = t_{j+1} - t_j\) for all \(j\).

Parameters:
states(r, k) ndarray

State snapshots: states[:, j] is the state at time \(t_j\).

dtfloat

Time step between snapshots.

inputs(m, k) or (k,) ndarray or None

Inputs corresponding to the states, if applicable.

Returns:
_states(r, k - 4) ndarray

State snapshots, excluding the last four snapshots.

ddts(r, k - 4) ndarray

Time derivative estimates corresponding to the state snapshots.

_inputs(m, k - 4) or (k - 4,) ndarray or None

Inputs corresponding to _states, if applicable. Only returned if inputs is not None.