2
$\begingroup$

The plots do not update when I adjust the parameter 'b'. Here is my code:

Manipulate[
sol = NDSolve[{V'[t]*Exp[1/V[t]]*0.2 == Cosh[T[t]/120/V[t]/b] - 1/3, 
T'[t]/120 + 2*Exp[-1/V[t]]*Sinh[T[t]] == 0.000002, V[0] == 0.01, 
T[0] == 0}, {V[t], T[t]}, {t, 0, 2000000}], 
Column[{Plot[{V[t]} /. sol, {t, 0, 2000000}, PlotRange -> All, 
PlotLegends -> Automatic], 
Plot[{T[t]} /. sol, {t, 0, 2000000}, PlotRange -> All, 
PlotLegends -> Automatic]}], {b, 0.5, 1, 0.1}]
New contributor
Jun Yi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$

1 Answer 1

2
$\begingroup$

enter image description here

The form of Manipulate is

Manipulate[
    code;
    code;
    final_result (*what will get displayed*)
    ,  (* notice this is a COMMA *)
    control_variable,
    control_variable,
    other_options
]

Notice, you need ; to separate code in the body of Manipulate up to the final result that will be what is displayed followed by commas after that.

You have separated your code by commas instead.

Manipulate[
 sol = NDSolve[{V'[t]*Exp[1/V[t]]*0.2 == Cosh[T[t]/120/V[t]/b] - 1/3, 
    T'[t]/120 + 2*Exp[-1/V[t]]*Sinh[T[t]] == 0.000002, V[0] == 0.01, 
    T[0] == 0},
   {V[t], T[t]}, {t, 0, 2000000}
   ];
 Column[{Plot[{V[t]} /. sol, {t, 0, 2000000}, PlotRange -> All, 
    PlotLegends -> Automatic],
   Plot[{T[t]} /. sol, {t, 0, 2000000}, PlotRange -> All, 
    PlotLegends -> Automatic]}]
 ,
 {b, 0.5, 1, 0.1}
 , TrackedSymbols :> {b}]
$\endgroup$

Your Answer

Jun Yi is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.