Skip to contents

LinearizationProblem(sys, inputs, outputs, t = 0, ...) builds a problem that is linearized by solve(prob) at its current operating point. Values of unknowns and parameters are changed with prob[x] <- value and the time with prob$t <- value between calls, which avoids compiling the system again. solve() returns a list with the matrices A, B, C, D and extras.

Usage

LinearizationProblem(sys, inputs = NULL, outputs = NULL, t = 0, ...)

# S3 method for class 'LinearizationProblem'
solve(a, b, allow_input_derivatives = FALSE, eliminate_algebraic = FALSE, ...)

Arguments

sys

A System, or a LinearizationFunction.

inputs, outputs

Lists of variables.

t

Time of the linearization.

...

Passed to linearization_function().

a

A LinearizationProblem.

b

Unused.

allow_input_derivatives, eliminate_algebraic

See linearize().

Value

A LinearizationProblem.

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t); u <- Variable("u", t, input = TRUE)
a <- Parameter("a", default = 1)
sys <- System(list(D(x) ~ -a * x^2 + u), t, name = "s")
prob <- LinearizationProblem(sys, list(u), list(x), op = list(x ~ 1, u ~ 0))
solve(prob)$A
#>      [,1]
#> [1,]   -2
prob[x] <- 2
solve(prob)$A
#>      [,1]
#> [1,]   -4