polynomialToMdss

Method of stringParser.

Build an mdss model from polynomial equation strings, clearing fractions and reducing integer powers.

Source: src/utilities/@stringParser/polynomialToMdss.m

Syntax

sys = stringParser.polynomialToMdss(poly_str_cell, Ts)
sys = stringParser.polynomialToMdss(poly_str_cell, Ts, symbols)
sys = stringParser.polynomialToMdss(poly_str_cell, Ts, symbols, symbolicParameters, numericParameters)

Description

polynomialToMdss is the middle stage of the parsing pipeline symbolicToMdsspolynomialToMdssstringToMdss. It takes equations written as polynomials and prepares them for the term-by-term parser, then hands the result to stringToMdss, which assembles the mdss object.

Each equation is first rearranged into implicit form 0 = h(…): the right-hand side is moved over so that only 0 remains on the left. simplifyFraction and expand are then applied, and any remaining denominator is cleared by multiplying through, so the equation becomes a pure polynomial.

Integer powers are reduced to multilinear products. For each variable that appears raised to a power, an auxiliary algebraic variable and a defining equation are introduced (for example y1^3 is rewritten using a fresh algebraic variable so that only products of distinct factors remain). New auxiliary variables continue the existing algebraic index range. Because powers are handled structurally, exponents cannot be identified as parameters, and only integer powers are allowed.

Multiplication must be written explicitly with * (a*x1, not a x1). Inequalities (>=, <=) are recognized and passed on as inequality rows; equalities keep the form 0 == ….

Symbols

The third argument maps each variable role to its symbol prefix, in the order

[stateDelta, state, input, algebraic, binary]

with default ["xp", "x", "u", "y", "z"]. You may supply fewer symbols: the list is taken as a prefix of the five roles and the missing trailing roles keep their default names, so ["xp","x"] parses a pure ODE system with no inputs, algebraic or binary variables.

Parameters

Symbolic parameters and their numeric values are passed inline as the fourth and fifth arguments and substituted during the final stringToMdss stage. Omitting them keeps the parameters symbolic.

Input arguments

Argument Description
poly_str_cell Polynomial equations as a string / string array. Multiplication must be explicit (*).
Ts Sample time: 0 continuous-time, >0 discrete-time.
symbols (optional) role symbols, default ["xp","x","u","y","z"].
symbolicParameters (optional) symbolic parameters to substitute.
numericParameters (optional) numeric values, aligned with symbolicParameters.

Output arguments

Output Description
sys The assembled mdss model.

Example

eq = ["xp1 = a*x1^2 + x2"; ...
      "xp2 = x1/(1 + b*x2)"];

sys = stringParser.polynomialToMdss( ...
        eq, 0, ["xp","x","u","y","z"], ...
        sym(["a","b"]), [0.5, 2]);

See also

mdss · symbolicToMdss · stringToMdss


Authors: Torben Warnecke, Nicholas Tedjosantoso.


MyToolbox Documentation | Generated automatically by CI/CD pipeline