# SystemModelLinearize

The following are the state matrices A and B obtained by linearization using SystemModelLinearize ("DocumentationExamples. Modeling. Generator" is the circuit given by the official routine). I want to change this type of variable(Quantity variable) in the matrix to a variable that can be assigned(R1、R2、L), or to a variable that we define ourselves. What should I do?

If the case cannot run normally, you can open the website(https://reference.wolfram.com/language/ref/SystemModelLinearize.html.zh). The case is probably in the middle of the page.The bottom picture is the case shown.

spacemodel =
SystemModelLinearize["DocumentationExamples.Modeling.Generator",
Method -> {"SymbolicDerivative",
"SymbolicParameters" -> {"R1", "R2", "L"}}]
R1 = 10;
R2 = 20;
L = 0.02;
A = spacemodel[[1, 1]]
B = spacemodel[[1, 2]]


• I get an error when I run your first line of code !Mathematica graphics SystemModelLinearize::bld: Failed to build model DocumentationExamples.Modeling.Generator. V 13.1 Where is this thing called "DocumentationExamples.Modeling.Generator" ?? Nov 24, 2022 at 5:53
• reference.wolfram.com/language/ref/SystemModelLinearize.html.zh）You can open this URL. This routine is roughly in the middle of the page. Nov 24, 2022 at 6:15
• It does not work. !Mathematica graphics SystemModelLinearize::bld: Failed to build model DocumentationExamples.Modeling.InvertedPendulum.Components.DCMotor. V 13.1 on windows. !Mathematica graphics SystemModelLinearize::bld: Failed to build model DocumentationExamples.Modeling.InvertedPendulum.Components.DCMotor. Nov 24, 2022 at 6:25
• I guess it may be the version problem. I used Mathematica 13.0 Nov 24, 2022 at 6:27
• it says  [EXPERIMENTAL] so I could have bugs. Nov 24, 2022 at 6:27

Too long for comment, but can you use these replacements for your symbolic variables? If not, then add a desirable output for A and B to your post.

R1 = Quantity[10, "Ohms"];
R2 = Quantity[20, "Ohms"];
L = Quantity[0.02, "Henries"];

rule1 = {QuantityVariable["R1", IndependentPhysicalQuantity[""]] ->
R1, QuantityVariable["R2", IndependentPhysicalQuantity[""]] -> R2,
QuantityVariable["L", IndependentPhysicalQuantity[""]] -> L}

A1 = spacemodel[[1, 1]] /. rule1 // UnitSimplify // FullSimplify


$$\left( \begin{array}{ccc} 0. & 1. & 0. \\ 0. & 0. & 0. \\ 0. & 50./\text{H} & -1500.\text{Hz} \\ \end{array} \right)$$