Skip to content
/ lti Public

General state-space representation of linear, time-invariant systems in Golang

License

Notifications You must be signed in to change notification settings

konimarti/lti

Repository files navigation

Linear and time-invariant systems in Golang

License GoDoc goreportcard

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.

Usage

	// 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))
}

Example

See example here.

More information

For additional materials on state-space models for control theory, check out the following links:

  • A practical guide to state-space control here
  • State-space model impelmentation for Arduinos here

Credits

This software package has been developed for and is in production at Kalkfabrik Netstal.