練習: 非線形連立微分方程式の計算

"ex_difeqs.nb"2007年6月8日  伊藤 明

In[22]:=

Clear[y, x]              &n ...              (* 変数yとxの中身を初期化 *)

A[t_] = -2 + 10 t * UnitStep[0.3 - t] - x[t] ;     (* t = 0.3 で変化する微分係数の項 *)

B[t_] = -2 + 10 t * UnitStep[0.4 - t] - y[t] ;     (* t = 0.4 で変化する微分係数の項 *)

eq1 = y '[t] == A[t] * y[t] + x[t] ;          &n ... p;             (* yに関する微分方程式 *)

eq2 = x '[t] == B[t] * x[t] + y[t] + 2 ;                      (* xに関する微分方程式 *)

cond1 = y[0] == 1 ;              ... ;           (* 初期状態 *)
cond2 = x[0] == 1 ;

sol1 = NDSolve[{eq1, eq2, cond1, cond2}, {y, x}, {t, 0, 3}] ;    (* 微分方程式の数値解析 *)

y[t_] = First[y[t]/.sol1] ;           &nbs ... nbsp;             (* 計算結果の代入 *)

x[t_] = First[x[t]/.sol1] ; 
          &nb ... ;              (* グラフ描画 *)

Plot[{y[t], x[t]}, {t, 0, 3}, PlotStyle-> {Red, Blue}, PlotRange -> All, PlotLabel->"y[t], x[t]"] ;

Plot[{A[t], B[t]}, {t, 0, 3}, PlotStyle-> {Red, Blue}, PlotRange -> All, PlotLabel->"A[t], B[t]"] ;

[Graphics:HTMLFiles/index_12.gif]

[Graphics:HTMLFiles/index_13.gif]


Created by Mathematica  (June 8, 2007) Valid XHTML 1.1!