Message Boards Message Boards

2 Replies
1 Total Likes
View groups...
Share this post:

How to Graph the Solution for Range of a Parameter

Posted 11 years ago
Hi All,

I need some help to visualize my PDE solution which contains a few parematers. When I fix the parematers it just works fine. See the code--3.nb

But what I need is fix all paremeters except say A, and get the solution for each value of A.. I attemted to use Table for A (See --3-copy.nb), but it does not work, I guess I shoulg change Plot code..

Any suggestion. Thanks in advance..

POSTED BY: selahittin cinar
2 Replies
Thanks. I have found a way to do that. I have added table in plot code..
  Evaluate[Table[{i*h, t,
     First[Subscript[u, i][t] /. lines /. A]}, {i, 0, n}]], {t, 0,
   1000}, PlotRange -> All,
  AxesLabel -> {"Spatial(x)", "Time(t)", "Height(h)"},
  BoxRatios -> {6, 6, 6},
  PlotStyle -> Directive[Magenta, Opacity[0.25]], ViewAngle -> All,
  Boxed -> False, ImageSize -> Medium], {A, 10, 6000, 3000}]
This way, I did not define A at the beginning and assigne the A value in plot.. It is for 3 A value but one reduce the step size to get more A value graph..
POSTED BY: selahittin cinar
Use ParametricNDSolve.

It's useful to know how to do this kind of thing without ParametricNDSolve as well. It teaches an important aspect of programming with Mathematica. The essence of it is to use
?NumericQ and define a function.  NDSolve requires that the parameters have an assigned value before it can run, so you have to be careful about the order that things evaluate in. Take a quick look at this article on the subject:

asically, it helps to define functions and then to use ?NumericQ when you expect the arguments to those functions to be numbers. 
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract