Message Boards Message Boards

0
|
4045 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Help with NDSolve inside Manipulate

Posted 11 years ago
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.
3 Replies
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}]
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
oh ,yes. now it's working. thank you very much!
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract