Forgot password?
 Create new account
View 122|Reply 0

MMA绘制非线性微分方程组的解

[Copy link]

462

Threads

969

Posts

9934

Credits

Credits
9934

Show all posts

青青子衿 Posted at 2023-5-13 12:08:15 |Read mode
Last edited by 青青子衿 at 2024-3-31 04:39:00
  1. eqns = {D[S[t], t] ==
  2.     10 - 0.8 S[
  3.        t]*\[ScriptCapitalI][t]/(S[t] + \[ScriptCapitalI][t]) -
  4.      0.8 S[t],
  5.    D[\[ScriptCapitalI][t], t] ==
  6.     0.8 S[t]*\[ScriptCapitalI][t]/(S[t] + \[ScriptCapitalI][t]) -
  7.      0.75 \[ScriptCapitalI][t],
  8.    D[Q[t], t] == 0.4 \[ScriptCapitalI][t] - 0.2 Q[t],
  9.    D[R[t], t] ==
  10.     0.7 S[t] + 0.25 \[ScriptCapitalI][t] + 0.1 Q[t] - 0.1 R[t],
  11.    S[0] == 50, \[ScriptCapitalI][0] == 20, Q[0] == 10, R[0] == 20};
  12. sol = NDSolveValue[eqns, {S, \[ScriptCapitalI], Q, R}, {t, 0, 30}];
  13. ParametricPlot[{{t, sol[[1]][t]}, {t, sol[[2]][t]}, {t,
  14.    sol[[3]][t]}, {t, sol[[4]][t]}}, {t, 0, 40}, AspectRatio -> 6/7,
  15. ImageSize -> Large,
  16. PlotLegends ->
  17.   Placed[LineLegend[{"S(t)", "I(t)", "Q(t)", "R(t)"},
  18.     LegendFunction -> (Framed[#, RoundingRadius -> 5] &),
  19.     LegendMargins -> 5], {1.0, 0.9}],
  20. PlotStyle -> {Red, Blue, Green, Purple}]
Copy the Code

手机版Mobile version|Leisure Math Forum

2025-4-20 21:46 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list