# General Nonlinear Systems

Just like affine systems, the general nonlinear systems can also be specified in multiple ways and be converted to other systems models.

A system specified using an ODE.

 In[1]:= XNonlinearStateSpaceModel[ m x''[t] + c[\[ScriptX]] x'[t] + k[x] == F[t], x[t], F[t], x[t], t]
 Out[1]=

A system specified using its components.

 In[2]:= XNonlinearStateSpaceModel[{{Subscript[f, 1][Subscript[x, 1], Subscript[ x, 2], Subscript[u, 1]], Subscript[f, 2][Subscript[x, 1], Subscript[x, 2], Subscript[u, 1]]}, {Subscript[h, 1][Subscript[x, 1], Subscript[x, 2], Subscript[u, 1]]}}, {Subscript[x, 1], Subscript[x, 2]}, {Subscript[u, 1]}]
 Out[2]=

Systems obtained from other systems models.

 In[3]:= XNonlinearStateSpaceModel /@ {StateSpaceModel[{{{Subscript[a, 11], Subscript[a, 12]}, {Subscript[a, 21], Subscript[a, 22]}}, {{Subscript[b, 11]}, {Subscript[b, 21]}}, {{Subscript[c, 11], Subscript[c, 12]}}, {{0}}}, {Subscript[x, 1], Subscript[x, 2]}, SamplingPeriod ->None, SystemsModelLabels -> None], TransferFunctionModel[{{{1}}, (-2) s + s^2}, s]}
 Out[3]=
 In[4]:= XNonlinearStateSpaceModel[ AffineStateSpaceModel[ {{Subscript[f, 1][Subscript[x, 1], Subscript[ x, 2]], Subscript[f, 2][Subscript[x, 1], Subscript[x, 2]]}, {{ Subscript[g, 11][Subscript[x, 1], Subscript[x, 2]] }, {Subscript[g, 21][Subscript[x, 1], Subscript[x, 2]] }}, {Subscript[h, 1][Subscript[x, 1], Subscript[x, 2]]}, {{ 0 }}}, {Subscript[x, 1], Subscript[x, 2]}, {Subscript[u, 1]}, {Automatic}, Automatic , SamplingPeriod -> None] ]
 Out[4]=

A linear NonlinearStateSpaceModel is exactly converted to linear systems models.

 In[5]:= Xnssm = NonlinearStateSpaceModel[ {{u + Subscript[x, 1] + Subscript[x, 2], u + Subscript[x, 1]}, {Subscript[x, 1]}}, {Subscript[x, 1], Subscript[x, 2]}, {u}, {Automatic}, Automatic , SamplingPeriod -> None];
 In[6]:= X{StateSpaceModel[nssm], TransferFunctionModel[nssm]}
 Out[6]=

An input-linear system is exactly converted to an AffineStateSpaceModel.

 In[7]:= XAffineStateSpaceModel[ NonlinearStateSpaceModel[ {{u + Subscript[x, 1] + Subscript[x, 2] + Subscript[x, 1] Subscript[x, 2], u + Subscript[x, 1] + \!\(\*SubsuperscriptBox[\(x\), \(2\), \(2\)]\)}, {Subscript[x, 1]}}, {Subscript[x, 1], Subscript[x, 2]}, {u}, {Automatic}, Automatic , SamplingPeriod -> None]]
 Out[7]=

In general, conversions to other systems models are approximate.

 In[8]:= Xnssm = NonlinearStateSpaceModel[ {{u + u^2 + Subscript[x, 1] + Subscript[x, 2] + Subscript[x, 1] Subscript[x, 2], u + Subscript[x, 1] + \!\(\*SubsuperscriptBox[\(x\), \(2\), \(2\)]\)}, {Subscript[x, 1]}}, {Subscript[x, 1], Subscript[x, 2]}, {u}, {Automatic}, Automatic , SamplingPeriod -> None];
 In[9]:= X{StateSpaceModel[nssm], TransferFunctionModel[nssm], AffineStateSpaceModel[nssm]}
 Out[9]=

## Mathematica

Questions? Comments? Contact a Wolfram expert »