construct a linear model of a system at a point - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Science and Engineering : Dynamic Systems : Linearization : DynamicSystems/Linearize

DynamicSystems[Linearize] - construct a linear model of a system at a point

Calling Sequence

Linearize( eqs, u, y, linpoint, opts)

Parameters

eqs

-

equation, expression, or set or list of equations or expressions; equations to be linearized. An expression expr, it is interpreted as the equation expr=0.

u

-

list or set; input variables

y

-

list or set; output variables

linpoint

-

list(equation) or set(equation); point around which the linearization is performed

opts

-

(optional) equation(s) of the form option = value; specify options for the Linearize command

Description

• 

The Linearize command computes the linearization of eqs about an operating point x0,u0 specified by linpoint. It is assumed that eqs can be reduced to the form

ⅆⅆtxt=fxt,ut

yt=gxt,ut

where:

xt represents the state variables of eqs converted to the first-order form;

ut represents the input variables specified by u;

yt represents the output variables specified by y;

f and g are nonlinear functions to be linearized;

t is a continuous time variable as specified by the continuoustimevar option in DynamicSystems[SystemOptions].

The Linearize command simplifies eqs to the above form and computes the following linear model

ⅆⅆtxt=axtx0+butu0+fx0,u0

yt=cxtx0+dutu0+gx0,u0

where a=xf, b=uf, c=xg, and d=ug are the Jacobian matrices evaluated at linpoint.

• 

The u parameter is a list or set of the input variables. Each element of u must be a function of t, where t corresponds to the independent time variable set by the continuoustimevar option to DynamicSystems[SystemOptions].

• 

The y parameter is a list or set of the output variables. Each element of y must be a function of t, where t corresponds to the independent time variable set by the continuoustimevar option to DynamicSystems[SystemOptions].

• 

The output of the Linearize command consists of a DynamicSystems object and three lists. The lists provide a mapping between the state, input, and output variables of the object and the state, input and output variables of the original equations, respectively.

• 

The DynamicSystems object represents the linearized system and is a state-space system object or as a  differential or algebraic equation system object.

  

The state-space form does not always represent the linearized system fully, since it includes only a, b, c, and d matrices. The Linearize command performs a check to determine whether the linear model has any terms in addition to axt, but, cxt, and dut. If it does, the Linearize command checks whether the given point was an equilibrium point, fx0,u0=0. If not, the Linearize command tries to find an equilibrium point for the linear model. If there is an equilibrium point (whether it is the linearization point or a newly found equilibrium point), the shift transformation is performed, and the variables used in the DynamicSystems object are the variables in eqs shifted by the equilibrium point: xtxep, utuep, ytgxep,uep, where xep,uep is an equilibrium point. If there are free terms and no equilibrium point can be found, the linearized equations are returned as a differential equation object. The effect of the check can be disabled using the checkpoint option.

• 

The given nonlinear equations eqs and the linearization point linpoint may contain symbolic parameters. Note, however, that if there are symbolic parameters present in eqs or linpoint and there are user-defined functions sepcified by the functions option, the linearization will likely fail.

Examples

withDynamicSystems:

Example 1: Basic usage

sys1:=ⅆⅆtx1t=x2t24,ⅆⅆtx2t=x1t1+ut,yt=x1t+x2t

sys1:=ⅆⅆtx1t=x2t24,ⅆⅆtx2t=x1t1+ut,yt=x1t+x2t

(1)

eq_point1:=EquilibriumPointsys1&comma;ut&comma;constraints&equals;0<x1t&comma;initialpoint&equals;ut&equals;0&comma;x1t&equals;2&comma;x2t&equals;4

eq_point1:=x1t&equals;1.49999999768708&comma;x2t&equals;2.00000001053627&comma;&DifferentialD;&DifferentialD;tx1t&equals;4.2145096301737810-8&comma;&DifferentialD;&DifferentialD;tx2t&equals;4.6258464836412810-9&comma;ut&equals;0.500000002312923&comma;yt&equals;0.500000012849197

(2)

lin_point1:=opeq_point11&comma;opeq_point13

lin_point1:=x1t&equals;1.49999999768708&comma;x2t&equals;2.00000001053627&comma;ut&equals;0.500000002312923

(3)

lin_model1a:=Linearizesys1&comma;ut&comma;yt&comma;lin_point1

lin_model1a:=State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t&comma;x1t&equals;x1t1.499999998&comma;x2t&equals;x2t&plus;2.000000011&comma;u1t&equals;ut&plus;0.500000002312923&comma;y1t&equals;yt&plus;0.5000000130

(4)

PrintSystemlin_model1a1

State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2ta&equals;04000000021100000000010b&equals;01c&equals;11d&equals;0

(5)

The linearization point lin_point does not give exact zero. Compute linear model for a tighter tolerance

lin_model1b:=Linearizesys1&comma;ut&comma;yt&comma;lin_point1&comma;&apos;equilibriumtolerance&apos;&equals;1.10-10

Warning, linpoint is not an equilibrium point

lin_model1b:=Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable&equals;u1toutputvariable&equals;y1t&comma;x1t&equals;x1t&comma;x2t&equals;x2t&comma;u1t&equals;ut&comma;y1t&equals;yt

(6)

PrintSystemlin_model1b1

Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable&equals;u1toutputvariable&equals;y1tde&equals;&lcub;&lsqb;x1.t&equals;8.0000000424.000000021x2t, x2.t&equals;x1t1+u1t, y1t&equals;x1t+x2t&rsqb;

(7)

Disable the checkpoint option for the same setting of the tolerance

lin_model1c:=Linearizesys1&comma;ut&comma;yt&comma;lin_point1&comma;&apos;equilibriumtolerance&apos;&equals;1.10-10&comma;&apos;checkpoint&apos;&equals;false

lin_model1c:=State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t&comma;x1t&equals;x1t1.499999998&comma;x2t&equals;x2t&plus;2.&comma;u1t&equals;ut&plus;0.499999998&comma;y1t&equals;yt&plus;0.500000002

(8)

Example 2: Use of user-defined functions

sys2 := {piecewise(x[1](t)<0, x[1](t), x[2](t) + x[1](t)^2) * piecewise(u(t)<0, cos(y(t)), sin(y(t))) = sin(x[1](t)^2) + 5 * y(t) + diff(x[1](t), t, t), y(t) - x[1](t)^2 + u(t)*x[1](t), diff(x[2](t), t) = f(x[1](t), u(t))};
user_function := [
    f,
    [float, float],
    float,
    proc(x, y)
    local d1, d2;
        d1 := cos(x)+x^2;
        d2 := y*d1 + y^2;
        return d1*x+d2*y- exp(d1);
    end proc
    ];

sys2:=ytx1t2&plus;utx1t&comma;&lcub;x1tx1t<0x2t&plus;x1t2otherwise&lcub;cosytut<0sinytotherwise&equals;sinx1t2&plus;5yt&plus;&DifferentialD;2&DifferentialD;t2x1t&comma;&DifferentialD;&DifferentialD;tx2t&equals;fx1t&comma;ut

user_function:=f&comma;float&comma;float&comma;float&comma;procx&comma;ylocald1&comma;d2&semi;d1:=cosx&plus;x&Hat;2&semi;d2:=y&ast;d1&plus;y&Hat;2&semi;returnd1&ast;x&plus;d2&ast;yexpd1end proc

(9)

eq_point2:=EquilibriumPointsys2&comma;ut&comma;functions&equals;user_function&comma;initialpoint&equals;x1t&equals;1&comma;x2t&equals;1&comma;ut&equals;1

eq_point2:=x1t&equals;0.853420831346895&comma;x2t&equals;0.687832129312234&comma;&DifferentialD;2&DifferentialD;t2x1t&equals;2.4374804397098210-9&comma;&DifferentialD;&DifferentialD;tx1t&equals;0.&comma;&DifferentialD;&DifferentialD;tx2t&equals;1.1415259848490710-9&comma;ut&equals;1.07055911392119&comma;yt&equals;0.185310333631790

(10)

lin_point2:=opeq_point21&comma;opeq_point23

lin_point2:=x1t&equals;0.853420831346895&comma;x2t&equals;0.687832129312234&comma;ut&equals;1.07055911392119

(11)

lin_model2a:=Linearizesys2&comma;ut&comma;yt&comma;lin_point2&comma;functions&equals;user_function

lin_model2a:=State Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t&comma;x3t&comma;x1t&equals;x1t0.8534208313&comma;x2t&equals;&DifferentialD;&DifferentialD;tx1t&comma;x3t&equals;x2t0.6878321293&comma;u1t&equals;ut1.07055911392119&comma;y1t&equals;yt&plus;0.1853103334

(12)

PrintSystemlin_model2a1

State Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t&comma;x3ta&equals;0101942023947083259875000000000000000001842515628191764571000000000000000000207684934000000000b&equals;0615843261721238912000000000000000064053159171000000000c&equals;15907063726970321925000000000000000000d&equals;853420831310000000000

(13)

Example of the statevariable, inputvariable, and outputvariable options

lin_model2b:=Linearizesys2&comma;ut&comma;yt&comma;lin_point2&comma;functions&equals;user_function&comma;statevariable&equals;XX&comma;inputvariable&equals;UU&comma;outputvariable&equals;YY

lin_model2b:=State Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable&equals;UU1toutputvariable&equals;YY1tstatevariable&equals;XX1t&comma;XX2t&comma;XX3t&comma;XX1t&equals;x1t0.8534208313&comma;XX2t&equals;&DifferentialD;&DifferentialD;tx1t&comma;XX3t&equals;x2t0.6878321293&comma;UU1t&equals;ut1.07055911392119&comma;YY1t&equals;yt&plus;0.1853103334

(14)

PrintSystemlin_model2b1

State Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable&equals;UU1toutputvariable&equals;YY1tstatevariable&equals;XX1t&comma;XX2t&comma;XX3ta&equals;0101942023947083259875000000000000000001842515628191764571000000000000000000207684934000000000b&equals;0615843261721238912000000000000000064053159171000000000c&equals;15907063726970321925000000000000000000d&equals;853420831310000000000

(15)

Example 3: Inverted pendulum on a moving cart

Variables

θt

counter-clockwise angular displacement of the pendulum from the upright position

φt

angular velocity of the pendulum, φt&equals;&DifferentialD;&DifferentialD;tθt

xt

position of the cart

yt

velocity of the cart, yt&equals;&DifferentialD;&DifferentialD;txt

ut

horizontal force applied to the cart

Parameters

L

half-length of pendulum

m

mass of the pendulum

M

mass of the cart

g

gravitational constant (9.8 ms2)

sys3:=&DifferentialD;&DifferentialD;txt&equals;yt&comma;&DifferentialD;&DifferentialD;t&theta;t&equals;&phi;t&comma;&DifferentialD;&DifferentialD;tyt&equals;3cos&theta;tsin&theta;tg2ut&plus;2mLsin&theta;t&phi;t23cos&theta;tm&plus;2M&plus;2m&comma;&DifferentialD;&DifferentialD;t&phi;t&equals;3sin&theta;tgMsin&theta;tgmmut&plus;m2Lsin&theta;t&phi;t23cos&theta;tm&plus;2M&plus;2mmL

sys3:=&DifferentialD;&DifferentialD;txt&equals;yt&comma;&DifferentialD;&DifferentialD;t&theta;t&equals;&phi;t&comma;&DifferentialD;&DifferentialD;tyt&equals;3cos&theta;tsin&theta;tg2ut&plus;2mLsin&theta;t&phi;t23cos&theta;tm&plus;2M&plus;2m&comma;&DifferentialD;&DifferentialD;t&phi;t&equals;3sin&theta;tgMsin&theta;tgmmut&plus;m2Lsin&theta;t&phi;t23cos&theta;tm&plus;2M&plus;2mmL

(16)

Linearization point is given by:

lin_point3:=&phi;t&equals;0&comma;xt&equals;0&comma;yt&equals;0&comma;&theta;t&equals;0&comma;ut&equals;0

lin_point3:=&phi;t&equals;0&comma;xt&equals;0&comma;yt&equals;0&comma;&theta;t&equals;0&comma;ut&equals;0

(17)

lin_model3:=Linearizesys3&comma;ut&comma;&phi;t&comma;xt&comma;yt&comma;&theta;t&comma;lin_point3

lin_model3:=State Spacecontinuous4 output(s); 1 input(s); 4 state(s)inputvariable&equals;u1toutputvariable&equals;y1t&comma;y2t&comma;y3t&comma;y4tstatevariable&equals;x1t&comma;x2t&comma;x3t&comma;x4t&comma;x1t&equals;&phi;t&comma;x2t&equals;&theta;t&comma;x3t&equals;xt&comma;x4t&equals;yt&comma;u1t&equals;ut&comma;y1t&equals;&phi;t&comma;y2t&equals;&theta;t&comma;y3t&equals;xt&comma;y4t&equals;yt

(18)

The state-space object given by lin_model3[1] can be used to construct a stabilizing controller using linear control theory.

PrintSystemlin_model31

State Spacecontinuous4 output(s); 1 input(s); 4 state(s)inputvariable&equals;u1toutputvariable&equals;y1t&comma;y2t&comma;y3t&comma;y4tstatevariable&equals;x1t&comma;x2t&comma;x3t&comma;x4ta&equals;03gM+gmm+2MmL001000000103gm+2M00b&equals;3m+2ML002m+2Mc&equals;1000010000100001d&equals;0000

(19)

See Also

DynamicSystems, DynamicSystems[AlgEquation], DynamicSystems[DiffEquation], DynamicSystems[EquilibriumPoint], DynamicSystems[StateSpace]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam