Message Boards Message Boards

Visualizing the graph inside a Manipulate

Posted 11 years ago

hi, I am not able to manipulate some plots, can someone please help in doing that, I am attaching the file for reference. I can see the graph with the slider, but I cannot see any change even if I change the slider position.

Thanks

Thanks, Jaydeep

Attachments:
POSTED BY: Jaydeep Yadav
4 Replies
Posted 11 years ago

In your untitled-1.nb near the bottom, Cb appears to be a function from your ParametricNDSolve, but then it looks like you use Cb as an independent variable {Cb, 0, 100} inside your Manipulate.

Look at this ParametricFunctionDocumentation and use your Cb in exactly the same way that page uses pfun and see if you can get your problem fixed.

In your 2.nb near the bottom Ca appears to be a function from your ParametricNDSolve, but if you look inside that you see it is Cb[ t ] and not Cb[ Km ] [ t ] . Again look at the documentation and try to understand exactly how to use functions.

I understand that Mathematica notation can often be very confusing and it can be very difficult to understand what the problem is or how to solve it. Studying how functions are defined and used, how Interpolating functions are defined and used and now how ParametricFunctions are defined and used will save you many hours of pain and suffering and needing to ask again and again and again "I typed some stuff in and it doesn't work. Please fix it."

POSTED BY: Bill Simpson
Posted 11 years ago

HI, thanks for the help. I am finding some error in this file. Please can you resolve this.

Attachments:
POSTED BY: Jaydeep Yadav
Posted 11 years ago

oops .... to many {km} at the end of model1. This is the correct version:

Model1 = ParametricNDSolve[{ Ca'[t] == ((Vmax Cb[t])/(Km + Cb[t]) - Pdiff Fuc Ca[t] + Pdiff Cb[t])/Va, Cb'[t] == (Pdiff Fuc Ca[t] - Pdiff Cb[t] - (Vmax Cb[t])/(Km + Cb[t]))/Vb, Ca[0] == 0, Cb[0] == Cb0 }, {Ca, Cb}, {t, 0, 100}, {Km}, PrecisionGoal -> Infinity]

POSTED BY: Luciano Iavelli
Posted 11 years ago

Hi Jaydeep

you ought to use ParametricNDSolve without defining in advance Km. So something like this for model1 (notice the parameters Km betwwen curly braces at the end) will work

Model1 = ParametricNDSolve[{ Ca'[t] == ((Vmax Cb[t])/(Km + Cb[t]) - Pdiff Fuc Ca[t] + Pdiff Cb[t])/Va, Cb'[t] == (Pdiff Fuc Ca[t] - Pdiff Cb[t] - (Vmax Cb[t])/(Km + Cb[t]))/Vb, Ca[0] == 0, Cb[0] == Cb0 }, {Ca, Cb}, {t, 0, 100}, {Km}, {Km}, PrecisionGoal -> Infinity]

Then to plot an actual solution vs a specific parameter value (here the first argument, 15, holds for the Km parameter):

Plot1 = Plot[Ca[15][t] /. Model1, {t, 0, 180}, PlotRange -> {{0, 45}, {0, 1000}}, PlotStyle -> Magenta]

A last this one will allow you to manipulate the solution of your model:

Manipulate[ Plot[Ca[Km][t] /. Model1, {t, 0, 180}, PlotRange -> {{0, 45}, {0, 1000}}], {Km, 0, 40}]

Hope this helps.

Luciano

POSTED BY: Luciano Iavelli
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