Linearize - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DynamicSystems

  

Linearize

  

construct a linear model of a system at a point

 

Calling Sequence

Parameters

Options

Description

Examples

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 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

Options

• 

simplify = truefalse

Specifies whether the given equations need to be simplified to the explicit nonlinear form above (true) or the system is already in this form and this step can be omitted (false). The default is true.

• 

functions = list of lists

The user-defined functions present in the system. Each function is described in a list of the form [name, input argument type list, output type, Maple function], where:

– 

name is the name of the function used in eqs;

– 

input argument type list is a list of valid types accepted by the function (currently, only functions with float arguments are supported);

– 

output type is the type of the output returned by the function (currently, only single-float- and void-valued  functions are supported);

– 

Maple function is a procedure defined in Maple, see Example 2 below.

• 

outputoption = statespace or equation

Specifies whether the linearized system should be returned as a state-space system object (statespace) or as a differential or algebraic equation system object (equation). The default is statespace.

• 

checkpoint = truefalse

If outputoption = statespace, a check is performed as to whether the linearized system is fully represented by the state-space object. The checkpoint option disables this check (false), and the state-space object is returned in terms of the original variables. By default, the check is always performed, checkpoint = true.

• 

equilibriumtolerance = positive

Specifies the value of δ used when checking whether linpoint is an equilibrium point. If fx0,u0δ then linpoint given by x0,u0 is considered to be an equilibrium point. If f consists of several components, the absolute value of each of them is tested. By default, δ=1.×10−7.

• 

inputvariable = name

Base name of the input variables of the generated DynamicSystems object. The default value is specified by DynamicSystems[SystemOptions].

• 

outputvariable = name

Base name of the output variables of the generated DynamicSystems object. The default value is specified by DynamicSystems[SystemOptions].

• 

statevariable = name

Base name of the state variables of the generated DynamicSystems object. The default is specified by DynamicSystems[SystemOptions].

• 

lintime = numeric

Specifies the time at which the system is linearized. This value is needed for time-varying systems and for piecewise functions with conditions depending on time. The default value is 0.

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=ⅆfⅆx, b=ⅆfⅆu, c=ⅆgⅆx, and d=ⅆgⅆu 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 specified by the functions option, the linearization will likely fail.

Examples

withDynamicSystems:

Example 1: Basic usage

sys1diffx1t,t=x2t24,diffx2t,t=x1t1+ut,yt=x1t+x2t

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

(1)

eq_point1EquilibriumPointsys1&comma;ut&comma;constraints=0<x1t&comma;initialpoint=ut=0&comma;x1t=2&comma;x2t=4

eq_point1x1t=1.49999999768708&comma;x2t=−2.00000001053627,&DifferentialD;&DifferentialD;tx1t=4.21450963017378×10−8&comma;&DifferentialD;&DifferentialD;tx2t=−4.62584648364128×10−9,ut=−0.500000002312923,yt=−0.500000012849197

(2)

lin_point1opeq_point11&comma;opeq_point13

lin_point1x1t=1.49999999768708&comma;x2t=−2.00000001053627&comma;ut=−0.500000002312923

(3)

lin_model1aLinearizesys1&comma;ut&comma;yt&comma;lin_point1

lin_model1aState Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t,x1t=x1t1.499999998&comma;x2t=x2t+2.000000011,u1t=ut+0.500000002312923,y1t=yt+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_model1bLinearizesys1&comma;ut&comma;yt&comma;lin_point1&comma;equilibriumtolerance=1.×10−10

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

(6)

PrintSystemlin_model1b1

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

(7)

Disable the checkpoint option for the same setting of the tolerance

lin_model1cLinearizesys1&comma;ut&comma;yt&comma;lin_point1&comma;equilibriumtolerance=1.×10−10&comma;checkpoint=false

lin_model1cState Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t,x1t=x1t1.499999998&comma;x2t=x2t+2.,u1t=ut+0.499999998,y1t=yt+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
    ];

sys2ytx1t2+utx1t&comma;x1tx1t<0x2t+x1t2otherwisecosytut<0sinytotherwise=sinx1t2+5yt+&DifferentialD;2&DifferentialD;t2x1t&comma;&DifferentialD;&DifferentialD;tx2t=fx1t&comma;ut

user_functionf&comma;float&comma;float&comma;float&comma;procx&comma;ylocald1&comma;d2&semi;d1cosx&plus;x&Hat;2&semi;d2y&ast;d1&plus;y&Hat;2&semi;returnx&ast;d1&plus;d2&ast;yexpd1end proc

(9)

eq_point2EquilibriumPointsys2&comma;ut&comma;functions=user_function&comma;initialpoint=x1t=1&comma;x2t=1&comma;ut=1

eq_point2x1t=0.853420831346895&comma;x2t=0.687832129312234,&DifferentialD;2&DifferentialD;t2x1t=2.43748043970982×10−9&comma;&DifferentialD;&DifferentialD;tx1t=0.&comma;&DifferentialD;&DifferentialD;tx2t=−1.14152598484907×10−9,ut=1.07055911392119,yt=−0.185310333631790

(10)

lin_point2opeq_point21&comma;opeq_point23

lin_point2x1t=0.853420831346895&comma;x2t=0.687832129312234&comma;ut=1.07055911392119

(11)

lin_model2aLinearizesys2&comma;ut&comma;yt&comma;lin_point2&comma;functions=user_function

lin_model2aState Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable&equals;u1toutputvariable&equals;y1tstatevariable&equals;x1t&comma;x2t&comma;x3t,x1t=x1t0.8534208313&comma;x2t=&DifferentialD;&DifferentialD;tx1t&comma;x3t=x2t0.6878321293,u1t=ut1.07055911392119,y1t=yt+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;010874609832452496122517998136852480331918107902983718014398509481984207684934000000000b&equals;06933778710027625225179981368524864053159171000000000c&equals;2865561850933691450359962737049600d&equals;853420831310000000000

(13)

Example of the statevariable, inputvariable, and outputvariable options

lin_model2bLinearizesys2&comma;ut&comma;yt&comma;lin_point2&comma;functions=user_function&comma;statevariable=XX&comma;inputvariable=UU&comma;outputvariable=YY

lin_model2bState Spacecontinuous1 output(s); 1 input(s); 3 state(s)inputvariable&equals;UU1toutputvariable&equals;YY1tstatevariable&equals;XX1t&comma;XX2t&comma;XX3t,XX1t=x1t0.8534208313&comma;XX2t=&DifferentialD;&DifferentialD;tx1t&comma;XX3t=x2t0.6878321293,UU1t=ut1.07055911392119,YY1t=yt+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;010874609832452496122517998136852480331918107902983718014398509481984207684934000000000b&equals;06933778710027625225179981368524864053159171000000000c&equals;2865561850933691450359962737049600d&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=&DifferentialD;&DifferentialD;tθt

xt

position of the cart

yt

velocity of the cart, yt=&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)

sys3diffxt&comma;t=yt&comma;diffθt&comma;t=φt&comma;diffyt&comma;t=3cosθtsinθtg2ut+2mLsinθtφt23cosθtm+2M+2m&comma;diffφt&comma;t=3sinθtgMsinθtgmmut+m2Lsinθtφt23cosθtm+2M+2mmL

sys3&DifferentialD;&DifferentialD;txt=yt&comma;&DifferentialD;&DifferentialD;tθt=φt&comma;&DifferentialD;&DifferentialD;tyt=3cosθtsinθtg2ut+2mLsinθtφt23cosθtm+2M+2m&comma;&DifferentialD;&DifferentialD;tφt=3sinθtgMsinθtgmmut+m2Lsinθtφt23cosθtm+2M+2mmL

(16)

Linearization point is given by:

lin_point3φt=0&comma;xt=0&comma;yt=0&comma;θt=0&comma;ut=0

lin_point3φt=0&comma;xt=0&comma;yt=0&comma;θt=0&comma;ut=0

(17)

lin_model3Linearizesys3&comma;ut&comma;φt&comma;xt&comma;yt&comma;θt&comma;lin_point3

lin_model3State 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,x1t=φt&comma;x2t=θt&comma;x3t=xt&comma;x4t=yt,u1t=ut,y1t=φt&comma;y2t=θt&comma;y3t=xt&comma;y4t=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;03Mg+gmm+2MmL001000000103gm+2M00b&equals;3m+2ML002m+2Mc&equals;1000010000100001d&equals;0000

(19)

See Also

DynamicSystems

DynamicSystems[AlgEquation]

DynamicSystems[DiffEquation]

DynamicSystems[EquilibriumPoint]

DynamicSystems[StateSpace]