Qurak

Proportional derivative controller

3 ステップを1つのセッション内で順に実行します。各ステップはエンジンで実行済みで、以下の出力は実際に生成されたものです。

ステップ 1
system = {x''[t] == u[t], x'[0] == x[0] == 0, u[0] == 1};
control = WhenEvent[Mod[t, τ], u[t] -> kp(xref - x[t] - td x'[t])];
params = {kp -> 1, td -> 1, τ -> 1, xref -> 1};

出力なし - このステップは次のステップの準備をします。

ステップ 2
sol = NDSolve[{system, control} /. params, {x, u}, {t, 0, 12}, DiscreteVariables -> u];

出力なし - このステップは次のステップの準備をします。

ステップ 3
Plot[Evaluate[{xref /. params, x[t], u[t]} /. sol], {t, 0, 12}, PlotLegends -> {"xref", "x(t)", "u(t)"}]
出力
-Graphics-

使用する関数

関連レシピ

すべてのレシピ · 関数リファレンス · MCPクライアントから使う