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]}]