参数拟合
求能将给定数据最佳拟合至范德波尔(Van der Pol)方程的参数
.
peqns = {x''[t] - μ(1 - x[t] ^ 2)x'[t] + x[t] == 0, x[0] == 2, x'[0] == 0};
data = NDSolveValue[peqns /. μ -> 1., Table[{t, x[t] + RandomReal[{-.3, .3}]}, {t, 0, 10, .2}], {t, 10}];ListPlot[data, PlotRange -> All, PlotStyle -> Red, ImageSize -> Medium]pfun = ParametricNDSolveValue[{x''[t] - μ(1 - x[t] ^ 2)x'[t] + x[t] == 0, x[0] == 2, x'[0] == 0}, x, {t, 0, 10}, {μ}];fit = FindFit[data, pfun[μ][t], {{μ, 2}}, t]Show[ListPlot[data, PlotStyle -> Red], Plot[pfun[μ][t] /. fit, {t, 0, 10}], ImageSize -> Medium]