pykoop.dynamic_models.DuffingOscillator
- class DuffingOscillator(alpha=1, beta=-1, delta=0.1)
Bases:
ContinuousDynamicModel
Duffing oscillator model.
Equation is
\ddot{x} + \delta \dot{x} + \beta x + \alpha x^3 = u(t)
where usuallyu(t) = a \cos(\omega t)
.- __init__(alpha=1, beta=-1, delta=0.1)
Instantiate
DuffingOscillator
.
Methods
__init__
([alpha, beta, delta])Instantiate
DuffingOscillator
.f
(t, x, u)Implement differential equation.
g
(t, x)Implement output equation.
simulate
(t_range, t_step, x0, u, **kwargs)Simulate the model using numerical integration.
- f(t, x, u)
Implement differential equation.
- Parameters:
t (float) – Time (s).
x (np.ndarray) – State.
u (np.ndarray) – Input.
- Returns:
Time derivative of state.
- Return type:
np.ndarray
- g(t, x)
Implement output equation.
- Parameters:
t (float) – Time (s).
x (np.ndarray) – State.
- Returns:
Measurement of state.
- Return type:
np.ndarray
- simulate(t_range, t_step, x0, u, **kwargs)
Simulate the model using numerical integration.
- Parameters:
- Returns:
Time and state at every timestep. Each timestep is one row.
- Return type:
Tuple[np.ndarray, np.ndarray]