Qurak

Hybrid dynamical systems

نمونه 4 گام، به‌ترتیب در یک نشست اجرا می‌شوند. هر گام روی موتور اجرا شده و خروجی زیر همان چیزی است که تولید کرد.

گام 1
de[δ_] := {Subscript[x, 1]'[t] == Subscript[x, 2][t], Subscript[x, 2]'[t] == -Subscript[x, 1][t] + 2δ Subscript[x, 2][t] + 1};
ic = {Subscript[x, 1][0] == .5, Subscript[x, 2][0] == .5};
sol = NDSolve[{de[0.1], ic, WhenEvent[And[Subscript[x, 2][t] == 0, Subscript[x, 1][t] < 0], {Subscript[x, 1][t] -> -Subscript[x, 1][t]}]}, {Subscript[x, 1], Subscript[x, 2]}, {t, 0, 500}];

بدون خروجی - این گام چیزی را برای گام بعد آماده می‌کند.

گام 2
Row[Map[ParametricPlot[{Subscript[x, 1][t], Subscript[x, 2][t]} /. sol, {t, 0, #}, PlotPoints -> 500, PlotRange -> {{-1, 2.5}, {-2, 1.5}}]&, {10, 50, 150}]]
خروجی
-Graphics--Graphics--Graphics-
گام 3
resetOsc[δ_] := NDSolve[{de[δ], ic, WhenEvent[And[Subscript[x, 2][t] == 0, Subscript[x, 1][t] < 0], {Subscript[x, 1][t] -> -Subscript[x, 1][t]}]}, {Subscript[x, 1], Subscript[x, 2]}, {t, 0, 500}];
{sol1, sol2, sol3} = Map[resetOsc, {.1, .15, .2}];

بدون خروجی - این گام چیزی را برای گام بعد آماده می‌کند.

گام 4
Grid[{Map[ParametricPlot[{Subscript[x, 1][t], Subscript[x, 2][t]} /. sol1, {t, 0, #}, PlotPoints -> 500, PlotRange -> {{-3, 3}, {-3, 3}}]&, {10, 50, 150}],
	Map[ParametricPlot[{Subscript[x, 1][t], Subscript[x, 2][t]} /. sol2, {t, 0, #}, PlotPoints -> 500, PlotRange -> {{-3, 3}, {-3, 3}}, PlotStyle -> Green]&, {10, 50, 150}], Map[ParametricPlot[{Subscript[x, 1][t], Subscript[x, 2][t]} /. sol3, {t, 0, #}, PlotPoints -> 500, PlotRange -> {{-3, 3}, {-3, 3}}, PlotStyle -> Red]&, {10, 50, 150}]}]
خروجی
Grid[{{-Graphics-, -Graphics-, -Graphics-}, {-Graphics-, -Graphics-, -Graphics-}, {-Graphics-, -Graphics-, -Graphics-}}]

توابع به‌کاررفته

دستورهای کار مرتبط

همهٔ دستورهای کار · مرجع توابع · استفاده از این در کلاینت MCP