Message Boards Message Boards

Nonlinear feedback system

Posted 5 years ago

I have a set of nonlinear equation which i have solve it by using AffineStateSpaceModel. My code is given below. I have the following query

1.Is it correct to use OutputResponse syntax to find the solution of the AffineStateSpaceModel.

2.I use interpFN to extract each of the output from the solution. Is there any alternative way to extract the solution so that i can plot the graph.

3.And finally I wanted to use If condition as input value which I am unable to do it.

Kindly help me. Thanks in advance

{i1 = 10, i2 = -1, i3 = 0.9, i4 = Abs[Sqrt[1 - i3^2]], mu1 = 1, 
 mu2 = 0, mu3 = 0}

nsys = AffineStateSpaceModel[{{x3, x4, 0, 0, 0, 0, 0.6 x9, 0.6 x10, 0,
     0, 0, 0},

   {{0, 0}, {0, 0}, {x5, 0}, {x6, 0}, {-x3, 0}, {-x4, 0}, {0, 0}, {0, 
     0}, {0, 0.6 x11}, {0, 0.6 x12}, {0, -0.6 x9}, {0, -0.6 x10}},

   {x1, x2, x7, x8, x1 - x7, x2 - x8, 0.6 x10 - x4, x3 - 0.6 x9}},

  {{x1, i1}, {x2, i2}, {x3, i3}, {x4, i4}, {x5, -i4}, {x6, i3}, {x7, 
    0}, {x8, 0}, {x9, 1}, {x10, 0}, {x11, 0}, {x12, 1}}]

sol = OutputResponse[nsys,

   {-mu1*Dot[
       Normalize[{x1[t] - x7[t], x2[t] - x8[t]}], {0.6 x10[t] - x4[t],
         x3[t] - 0.6 x9[t]}]

     - mu2*
      Integrate[
       Dot[Normalize[{x1[t] - x7[t], x2[t] - x8[t]}], {0.6 x10[t] - 
          x4[t], x3[t] - 0.6 x9[t]}], t]

     - mu3*
      Dot[Normalize[{x1[t] - x7[t], 
         x2[t] - x8[t]}], {.36 x12[t] Dot[
          Normalize[{x1[t] - x7[t], x2[t] - x8[t]}], {-x10[t], 
           x9[t]}], -.36 x11[t] Dot[

          Normalize[{x1[t] - x7[t], x2[t] - x8[t]}], {-x10[t], 
           x9[t]}]}],
    Dot[Normalize[{x1[t] - x7[t], x2[t] - x8[t]}], {-x10[t], x9[t]}]},

   {t, 0, 300}];

u1 = interpFN = sol[[1]];
u2 = interpFN = sol[[2]];
u3 = interpFN = sol[[3]];
u4 = interpFN = sol[[4]];
u5 = interpFN = sol[[5]];
u6 = interpFN = sol[[6]];
u7 = interpFN = sol[[7]];
u8 = interpFN = sol[[8]];

ParametricPlot[{{u5, u6}}, {t, 0, 20}, Mesh -> 40, 
 GridLines -> Automatic]
{ParametricPlot[{{u1, u2}, {u3, u4}}, {t, 0, 15}, 
  PlotLegends -> {"pursuer", "evader"}, Frame -> True, 
  GridLines -> Automatic, Mesh -> 10], 
 ParametricPlot[{{u1, u2}, {u3, u4}}, {t, 0, 20}, 
  PlotLegends -> {"pursuer", "evader"}, Frame -> True, 
  GridLines -> Automatic], 
 ParametricPlot[{{u1, u2}, {u3, u4}}, {t, 0, 30}, 
  PlotLegends -> {"pursuer", "evader"}, Frame -> True, 
  GridLines -> Automatic, Mesh -> 30], 
 ParametricPlot[{{u1, u2}, {u3, u4}}, {t, 0, 300}, 
  PlotLegends -> {"pursuer", "evader"}, Frame -> True, 
  GridLines -> Automatic]}

r = EuclideanDistance[{u1, u2}, {u3, u4}]
Plot[r, {t, 0, 30}, GridLines -> Automatic, AxesLabel -> {t, "r"}]

gamma = Dot[Normalize[{u5, u6}], Normalize[{u7, u8}]]
Plot[gamma, {t, 0, 30}, GridLines -> Automatic, 
 AxesLabel -> {t, \[CapitalGamma]}]
POSTED BY: OBIROY LAIRENJAM
2 Replies

I appreciate for your suggestion

Basically my input to the system is not unit function.

2.I want parametric plot, like the path of of a moving object.

3.I will try to implement your suggestion of 'if' statement.

To make it clear i will put up the equation.

POSTED BY: OBIROY LAIRENJAM

Obiroy,

1: your OutputResponse syntax is wrong. I do not understand what you are trying to do. OutputResponse 2nd argument is an input that is independent of the states. For example, this would work:

    out = OutputResponse[nsys, {UnitStep[t], UnitStep[t]}, {t, 0, 300}];

to get a plot of all the outputs:

    Plot[out, {t, 0, 300}]

You have the inputs as a function of the states. MMA cannot interpret that properly and thinks that those are new variables that you have introduced. If you really intended to do that, you should add those state connections into the model using the various functions for that (i.e. SystemsModelSeriesConnect, SystemsModelFeedbackConnect, etc.)

2: I do not understand why you are using interpFN at all. The best way to make your assignment is

    {u1, u2, u3, u4, u5, u6, u7, u8} = sol;

3: you can use If in the input such as:

    out = OutputResponse[
       nsys, {If[t >= 100, Sin[t], 0], UnitStep[t]}, {t, 0, 300}];

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract