Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ε = 10^-6;
- solw = NDSolve[{w''[t] + (w[t] + w[t]^2) w'[t] == 1/2 (1 + Tanh[100 t]), w[0] == 0,
- w'[0] == 0}, w, {t, 0, 2 π}, Method -> "MethodOfLines"];
- wsol[t_] := Evaluate[w[t] /. solw]
- solG[s2_] :=
- NDSolve[{G''[t] + (G[t] + G[t]^2) G'[t] == s2 1/(Sqrt[π] ε) Exp[-(t/ε)^2], G[0] == 0,
- G'[0] == 0}, G, {t, 0, 2 π}, Method -> "MethodOfLines"]
- Gsol[t_] := Evaluate[G[t] /. solG[s2]]
- approx[t_] :=
- s1 NIntegrate[Gsol[t - τ] 1/2 (1 + Tanh[100 τ]), {τ, 0, t}, Method -> "DoubleExponential"]
- tab = Table[Abs[wsol[t] - Gsol[t]], {t, 0, 1, 0.01}];
- NMinimize[Max[tab], s1, s2]
Add Comment
Please, Sign In to add comment