linearize(sys, inputs, outputs) linearizes sys around the operating
point op at time t and returns the matrices of
$$x' = A x + B u, \quad y = C x + D u.$$
inputs and outputs are lists of variables or analysis points. The
state x is all unknowns of the simplified system sys (returned in
the result), as in ModelingToolkit's linearize: for a system with
algebraic unknowns z the state is (x, z) and
\(A = [f_x, f_z; G f_x, G f_z]\) with \(G = -g_z^{-1} g_x\); input
derivatives then need allow_input_derivatives = TRUE. With
eliminate_algebraic = TRUE the algebraic unknowns are eliminated
through \(z = -g_z^{-1}(g_x x + g_u u)\), so that
\(A = f_x - f_z g_z^{-1} g_x\) and the state is the differential
unknowns only.
Arguments
- sys
A
System, or the simplified system for the second form.- inputs, outputs
Lists of variables or analysis points; for the second form,
inputsis theLinearizationFunction.- op
Operating point, a variable map or a
LinearizationOpPoint().- t
Time of the linearization.
- allow_input_derivatives
Allow derivatives of inputs, see above.
- eliminate_algebraic
Eliminate algebraic unknowns from the state.
- zero_dummy_der
Set dummy derivatives to zero at the operating point.
- p
Further parameter values.
- ...
Passed to
linearization_function().
Value
A list with matrices A, B, C, D, the simplified system
sys, the names of the states, and extras, the operating point
list(x, p, t) after initialization. With a vector of times in a
LinearizationOpPoint, a list of such results.
Details
linearize(ssys, lin_fun) linearizes with a function from
linearization_function(), which avoids compiling again for new
operating points.
Examples
t <- t_nounits; D <- D_nounits
x <- Variable("x", t); v <- Variable("v", t)
F <- Variable("F", t, input = TRUE); y <- Variable("y", t, output = TRUE)
m <- Parameter("m", default = 2); k <- Parameter("k", default = 4)
c <- Parameter("c", default = 1)
msd <- System(list(D(x) ~ v, D(v) ~ (F - k * x - c * v) / m, y ~ x), t, name = "msd")
lin <- linearize(msd, list(F), list(y), op = list(x ~ 0, v ~ 0, F ~ 0))
lin$A; lin$B; lin$C; lin$D
#> [,1] [,2]
#> [1,] 0 1.0
#> [2,] -2 -0.5
#> [,1]
#> [1,] 0.0
#> [2,] 0.5
#> [,1] [,2]
#> [1,] 1 0
#> [,1]
#> [1,] 0