1
$\begingroup$

There are two systems in the state space with an ideal and a real differentiator.

enter image description here

enter image description here

For the first system, the code in Mathematica is as follows.

nsys = NonlinearStateSpaceModel[
  x'[t] == D[Power[x[t], 2], t] + 0.01 Sin[10 t], x[t], u[t], x[t], t]
Plot[Evaluate@OutputResponse[{nsys, 1}, 0, {t, 0, 20}], {t, 0, 20}]

What will the code look like for receiving the output signal if instead of the ideal differentiator in feedback the real differentiator?

$\endgroup$
3
$\begingroup$

The equations can be constructed from the block diagram and then directly passed to NDSolve.

eqns = {x'[t] == u[t] + f[t], f'[t] + f[t] == D[Power[x[t], 2], t]} /. u[t] -> 0.01 Sin[10 t];
x[t] /. NDSolve[Join[%, {x[0] == 0.5, f[0] == 0}], {x[t], f[t]}, {t, 0, 5}];
p1 = Plot[%, {t, 0, 5}];

Or we can use SystemsConnectionsModel to build the model and go from there.

add = TransferFunctionModel[{{1, 1}}, s];
int = TransferFunctionModel[1/s, s];
sq = NonlinearStateSpaceModel[{{}, u^2}, {}, u];
diff = TransferFunctionModel[s/(s + 1), s];
SystemsConnectionsModel[{add, int, sq, diff}, 
  {{1, 1} -> {2, 1}, {2, 1} -> {3, 1}, {3, 1} -> {4, 1}, {4, 1} -> {1, 2}}, 
  {{1, 1}}, {{2, 1}}] // SystemsModelMerge
p2 = Plot[Evaluate@OutputResponse[{%, {0.5, 0.5^2}}, 0.01 Sin[10 t], {t, 0, 5}], {t, 0, 5}];

enter image description here

Both approaches should give the same result.

Show[p1, p2]

enter image description here

(The latter approach will not work for the ideal differentiator because NonlinearStateSpaceModel does not support descriptor systems yet.)

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Dear Suba Thomas, the question arose: is it possible to write down the equation of the above systems in the form $x'=Ax+Bu$ (with one state-space variable, not two), or because of the differentiating links is impossible? $\endgroup$ – dtn Jan 6 at 5:01
  • $\begingroup$ @AndySol You can get an affine representation using AffineStateSpaceModel[eqns, {x[t], f[t]}, u[t], x[t], t]. It will have two states and will be of the form $x'=a(x)+b(x).u$ . The second state comes from the pole in the denominator of the real differentiator. (eqns = {x'[t] == u[t] + f[t], f'[t] + f[t] == D[Power[x[t], 2], t]}) $\endgroup$ – Suba Thomas Jan 6 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.