go get github.com/konimarti/lti
-
State-space representation and estimation of linear, time-invariant systems for control theory in Golang
$$x'(t) = A * x(t) + B * u(t)$$ and
$$y(t) = C * x(t) + D * u(t)$$ -
Can be used as an input for a Kalman filter.
// define time-continuous linear system
system, err := lti.NewSystem(
...
)
// check system properties
fmt.Println("Observable=", system.MustObservable())
fmt.Println("Controllable=", system.MustControllable())
// define initial state (x) and control (u) vectors
...
// get derivative vector for new state
fmt.Println(system.Derivative(x, u))
// get output vector for new state
fmt.Println(system.Response(x, u))
// discretize LTI system and propagate state by time step dt
discrete, err := system.Discretize(dt)
fmt.Println("x(k+1)=", discrete.Predict(x, u))
}
See example here.
For additional materials on state-space models for control theory, check out the following links:
This software package has been developed for and is in production at Kalkfabrik Netstal.