# Non-linear ODE from closed-loop system and Response

I started using Mathematica 12 and ran into difficulties. Namely, I want to compare the results of the calculation of a closed system from Simulink and in Mathematica. I rummaged around a bit on the Internet and found an implementation of nonlinear state spaces. Having written my code, I encountered a difficulty, namely the implementation of integration. Help me to understand. https://reference.wolfram.com/language/ref/NonlinearStateSpaceModel.html  nsys = NonlinearStateSpaceModel[{{u Subscript[x, 2], Subscript[x, 2] == Integral[Subscript[x, 1]]}, {Subscript[x, 2]}}, {Subscript[x, 1], Subscript[x, 2]}, u]
OutputResponse[nsys, Sin[t], {t, 0, 5}];
Plot[%, {t, 0, 5}]


You could do the following to get the NonlinearStateSpaceModel

nsys = NonlinearStateSpaceModel[x2'[t] == u[t] x2[t], x2[t], u[t], x2[t], t] And then simulate it

Plot[Evaluate@OutputResponse[{nsys, 0.0001}, Sin[t], {t, 0, 20}], {t, 0, 20}] Alternatively, you can use SystemsConnectionsModel and SystemsModelMerge to get nsys

product5 = NonlinearStateSpaceModel[{{}, u1  u2}, {}, {u1, u2}];
integrator4 = TransferFunctionModel[1/s, s];
SystemsModelMerge[SystemsConnectionsModel[{product5, integrator4},
{{1, 1} -> {2, 1}, {2, 1} -> {1, 2}}, {{1, 1}}, {{2, 1}}]] • Dear Suba Thomas, thanks for your reply. The results are similar to what Simulink produces. Another question is whether it is possible to obtain a differential equation describing the output signal from a nonlinear state space. I mean the Nonlinear Article-Spas transformation -> Differential equation. And that means "gray dot" under the symbol x1. This notation is not known to me. – dtn Aug 18 '19 at 5:46
• Not out of the box, but you can do something along the lines of With[{res = Normal[nsys]}, {Thread[D[res[], res[]] == res[[1, 1]]], res[[1, 2]]}]. The formal variables (\[FormalT], \[FormalX], etc) are kind of special variables. If you assign something to them it could mess up the results. – Suba Thomas Aug 19 '19 at 13:36
• I do not understand the meaning of this expression. Could you explain it in more detail? – dtn Aug 20 '19 at 6:39
• Could you clarify what it is that you are not understanding? – Suba Thomas Aug 20 '19 at 22:06
• In principle, I feel that i can figure out the code by reading the directory on the Wolphram website. Only one thing I want to clarify - what does the "gray dot" mean under the symbol x1. – dtn Aug 22 '19 at 6:16