NonlinearStateSpaceModelCopy to clipboard.
✖
NonlinearStateSpaceModel
gives a state-space representation corresponding to the systems model sys.
gives the state-space model of the differential equations eqns with dependent variables xi, input variables ui, operating values xi0 and ui0, outputs gi, and independent variable t.
Details and Options

- NonlinearStateSpaceModel is a general representation state-space model.
- NonlinearStateSpaceModel[{f},x,u] assumes
.
- NonlinearStateSpaceModel[{f,g},x,u,y,t] explicitly specifies the output variables y and independent variable t.
- NonlinearStateSpaceModel allows for operating values for the states x and inputs u.
- NonlinearStateSpaceModel[…,{{x1,x10},…},{{u1,u10},…},…] is used to indicate the operating values for the system.
- In NonlinearStateSpaceModel[sys] the following systems can be converted:
-
AffineStateSpaceModel exact conversion StateSpaceModel exact conversion TransferFunctionModel exact conversion - In NonlinearStateSpaceModel[eqns,…] the Taylor linearization is with respect to the highest-order derivatives of
about the point
of the differential equations eqns.
- In computations where the operating point vi0 is Automatic, it is usually assumed to be zero.
- The following options can be given:
-
ExternalTypeSignature Automatic variable types for embedded code SamplingPeriod Automatic sampling period SystemsModelLabels Automatic variable labels - NonlinearStateSpaceModel can be used in functions such as OutputResponse and SystemsModelSeriesConnect.
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Define the nonlinear system with output
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-w1u2e3

Plot its response to a step input with initial states at the origin:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-30nq1o

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-e417dy

Scope (18)Survey of the scope of standard use cases
Basic Uses (5)
A system with 2 states , 1 input
, and 1 output:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-yggkg0

Count the number of inputs and outputs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-se2p4g


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-qygmr3

A system with 2 inputs and 1 output:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-67plh6

The response to a unit step applied to each input channel while holding the other at zero:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-w7gfar

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-botf6h

A system with 1 input and 2 outputs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-t141qv


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-lkncwf

Connect the gains in series with the original system:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-dz40mn

Specify operating values for the states:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-etk9ta

Obtain the StateSpaceModel using linearization about the operating values:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-rmi4jf

Explicitly specify the output and independent variables:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-mkoani

System Conversions (4)
The nonlinear representation of a StateSpaceModel with specified states:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-h0blc5

The nonlinear state-space representation of a TransferFunctionModel with default states:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-cga5w

The nonlinear representation of an AffineStateSpaceModel, preserving states:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-844ro3

The nonlinear state-space representation of a set of ODEs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-w61bwh

Model Manipulations (3)

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-tvja2g

Set new state, input, and output variables:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-djskhv

Use state , input
, and output
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-hrlynv

Use Normal to get the model's arguments:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-uptyi

Operating Values (6)
States and inputs deleted using SystemsModelDelete are set to their operating values:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-qcqog8

So are the states and inputs not extracted by SystemsModelExtract:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-yp93w4

StateSpaceTransform computes the operating values of the new states if the old were specified:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-04byil

By default, the simulation functions assume the operating values as the initial values:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-msdx1e

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-ztqh0e


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-nneiy2

StateSpaceModel linearizes about all operating values:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-3898hh

AffineStateSpaceModel only linearizes about operating values of input variables:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-l63hg3

NonlinearStateSpaceModel preserves operating values specified along with ODEs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-ftk6w3

FullInformationOutputRegulator linearizes about the operating values to compute the gains :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-670p9n

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-3r6igj

Compute the gains from the linearized subsystem:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-hhlogi

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-2emlwi

Generalizations & Extensions (1)Generalized and extended use cases
Options (1)Common values & functionality for each option
Applications (5)Sample problems that can be solved with this function
Chemical Systems (2)
Use NonlinearStateSpaceModel to specify the equations for a two-tank system and simulate it:

Use Bernoulli's law and mass balance to derive the resulting differential equations:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-veaqch
Use steady-state operating values :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-i0j93y

Define the corresponding nonlinear system with input and output
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-thzdse

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-t97hw6

With a higher steady-state value for flow rate, the level in the tanks settles at a higher level:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-u8xmot

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-15cmz8

Control the level in the second tank below using a PID controller:


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-d2o4bn
Obtain a PID controller using the linearized model and PIDTune:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-p7jscs

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-zzim9z

Specify a piecewise reference value for the liquid level in the second tank:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-qzhkku
The simulations show how the closed-loop system follows the reference:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-svp0gk

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-oh2rlv

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-5t977n

Aerospace Systems (2)
Find the equations of motion of an aircraft's longitudinal dynamics , where the states
are
and the inputs
are
: »


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-ty24kc
Here , , and ℳ are taken to be polynomials in α and δe:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-cmobzo

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-4hsg9f
The aerodynamic and model parameters:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-x9k105
Use , where
is the flight path angle and
the pitch angle:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-8yqbvu
Find the steady states for steady , level
flight at a specific speed
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-yq8hk6

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-ruztc


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-03jgn
Define state variables and initial values:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-dthi5d
The nonlinear state-space model of the aircraft with states and inputs
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-fz8bod

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-ccqvhv

The 2×2 transfer function representation of the linearized system:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-swgj3l

The system is unstable due to the poles in the right half-plane:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-j4zlhw

It is also nonminimum phase due to the zeros in the right half-plane:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-j27yq

The BodePlot shows that the velocity can be affected more than the flight path angle
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-sae4q0

The six-degree-of-freedom equations of motion of an aircraft. The rotation matrix for a rotation about an axis
: »

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-5w2o1u
The rotation matrices for the Euler angles ,
, and
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-zudb87

The matrix transformation of a vector from the body-fixed to the earth-fixed axes:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-xijbw4

The inverse transformation from the earth-fixed to the body-fixed axes:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-tkatit


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-7m1m4

A figure showing the earth-fixed axes and body-fixed axes
:

The Euler angle rates in terms of the angular velocity components ,
, and
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-t70wkm

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-5ym3yk

The kinematic equations for the Euler angles:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-v3y20c

The kinematic equations for the flight path variables ,
, and
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-7d1cip

The inertia matrix, assuming that the plane is a plane of symmetry:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-3y7ixw
The angular momentum can be computed as
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-7to0vy

A figure showing the forces and moments acting on the aircraft:

The state equations of the angular velocity can be obtained by solving the moment equation , where
is the vector of aerodynamic moments:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-gxudg2

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-54el9k

The dynamics of the rotational motion:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-cx3xtm

The forces acting on the aircraft are the aerodynamic forces , its weight, and the thrust
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-c2pwf1

The dynamics of the translational motion can be obtained from Newton's law :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-7q3pkm

The complete equations of motion for the aircraft:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-1pcj1v

The longitudinal dynamics are the dynamics for states ,
,
, and
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-lzdlce

The lateral dynamics are the dynamics for the states ,
,
, and
:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-f1v5i

Extended Kalman Filter (1)
Design an extended Kalman filter to track the motion of a wheeled robot:


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-ommd7u

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-n9vy3h

All the measurements are assumed to be noisy, with covariance :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-tjhofx

The gain of the filter is based on the covariance
of the states:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-9qol8f

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-zj00t7

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-i619lh

The right-hand side of the differential equation for the estimated states with noisy measurements :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-j1m56s
The right-hand side of the differential equation for the covariance matrix :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-onvcim

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-vwugfk
Assemble the estimator using NonlinearStateSpaceModel:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-uryifs

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-wnejhj

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-69mo7g

Simulate the robot from initial position and a set of inputs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-o7b41b

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-mg7dd

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-y5v33k


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-3ywv1i

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-n3qodz

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-g96zuo

Simulate the response of the filter using the inputs to the system and the noisy measurements:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-b670qj
Compare the actual, noisy, and filtered values of the variable :

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-oyfghv


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-68hk6c


https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-9bf6aw

Properties & Relations (3)Properties of the function, and connections to other functions
NonlinearStateSpaceModel converts to AffineStateSpaceModel by linearizing inputs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-o2mcfl

Conversion the other way is exact:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-1wejql

NonlinearStateSpaceModel converts to StateSpaceModel by linearizing states and inputs:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-if9q9y

Conversion the other way is exact:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-3n5tca

Convert to TransferFunctionModel by state and input linearization:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-g2lqcu

Conversion the other way is exact:

https://wolfram.com/xid/0jvpj762zmgvepb9y3y1-bldmrq

Wolfram Research (2014), NonlinearStateSpaceModel, Wolfram Language function, https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html.
Text
Wolfram Research (2014), NonlinearStateSpaceModel, Wolfram Language function, https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html.
Wolfram Research (2014), NonlinearStateSpaceModel, Wolfram Language function, https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html.
CMS
Wolfram Language. 2014. "NonlinearStateSpaceModel." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html.
Wolfram Language. 2014. "NonlinearStateSpaceModel." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html.
APA
Wolfram Language. (2014). NonlinearStateSpaceModel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html
Wolfram Language. (2014). NonlinearStateSpaceModel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html
BibTeX
@misc{reference.wolfram_2025_nonlinearstatespacemodel, author="Wolfram Research", title="{NonlinearStateSpaceModel}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html}", note=[Accessed: 02-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_nonlinearstatespacemodel, organization={Wolfram Research}, title={NonlinearStateSpaceModel}, year={2014}, url={https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html}, note=[Accessed: 02-April-2025
]}