Group Abstract Group Abstract

Message Boards Message Boards

Help with NDSolve inside Manipulate

GROUPS:
Guys please can you help me and tell me how to correct my code? I attached the file. i want to solve a system of 3 odes.
Answer
10 months ago
step[k_, a_] := k HeavisidePi[t/a - 1/2]
 Manipulate[
  Plot[Evaluate[{u[t], w[t], v[t]} /.
     NDSolve[ {u'[t] ==
        step[10, 20] + \[Lambda]1*u[t]^2/(1 + u[t]^2) - Log2/120*u[t] -
          v[t]*\[Alpha]*u[t],
       w'[t] == \[Lambda]1*u[t]^2/(1 + u[t]^2) - Log2/120*w[t],
       v'[t] == \[Lambda]1*1/(1 + w[t]^2)*step[10, 20] + \[Beta] -
         Log2/30*v[t], u[0] == w[0] == v[0] == 0}, {u, w, v}, {t, 0,
       100}]], {t, 0, 100}], {{\[Alpha], 0, TraditionalForm[auxin]}, 0,
   10},
{{\[Beta], 0, TraditionalForm[b]}, 0, 10},
{{\[Lambda]1, 0, TraditionalForm[lamda1]}, 0, 10}]
Answer
10 months ago
The main problem is that  Log2  is a function, not a number.  I substituted  Log[2]  for it and moved the diff. eq. outside  Manipulate  to avoid recalculating the solution many times.
 step[k_, a_] := k HeavisidePi[t/a - 1/2];
 psol = ParametricNDSolveValue[{
     u'[t] == step[10, 20] + \[Lambda]1*u[t]^2/(1 + u[t]^2) - Log[2]/120*u[t] - v[t]*\[Alpha]*u[t],
     w'[t] == \[Lambda]1*u[t]^2/(1 + u[t]^2) - Log[2]/120*w[t],
     v'[t] == \[Lambda]1*1/(1 + w[t]^2)*step[10, 20] + \[Beta] - Log[2]/30*v[t],
     u[0] == w[0] == v[0] == 0},
    {u[t], w[t], v[t]},
    {t, 0, 100},
    {\[Alpha], \[Beta], \[Lambda]1}];


Manipulate[
Plot[Evaluate@psol[\[Alpha], \[Beta], \[Lambda]1], {t, 0, 100}],
{{\[Alpha], 0, TraditionalForm[auxin]}, 0, 10},
{{\[Beta], 0, TraditionalForm[b]}, 0, 10},
{{\[Lambda]1, 0, TraditionalForm[lamda1]}, 0, 10}]
POSTED BY: Michael Rogers
Answer
10 months ago
oh ,yes. now it's working. thank you very much!
Answer
10 months ago