| Author |
Comment/Response |
sean kim
|
09/14/03 6:22pm
hello group.
it appears that the mathgroup has been down for sometime, so I decided to try this group.
i'm trying to get specific values out of interpolaing functions generated by NDSolve.
What I woudl like to do is to find the value of t that correspond to the maximum y[t] over the given range of t.
if there are more than maximum, then the first maximum y[t]value and the t value associated with it.
then after that, I have to figure out what the half maximal y[t] value is and the time associated with that.
i'm using lorenz equation as an example.
thanks much group.
In[10]:=
solution =
NDSolve[{Derivative[1][x][t] == -y[t] - z[t], x[0] == -0.04,
Derivative[1][y][t] == x[t] + 0.425*y[t], y[0] == -0.3,
Derivative[1][z][t] == 2 - (4 - x[t])*z[t], z[0] == 0.52}, {x[t], y[t],
z[t]}, {t, 0, 25}, Method -> RungeKutta]
(*ParametricPlot3D[Evaluate[{x[t], y[t], z[t]} /. solution], {t, 0, 25},
PlotPoints -> 1000, PlotRange -> All];*)
(*pulling out interpolating functions*)
interp = solution[[1, 2, 2]]
(*finding the maxvalues for y[t]*)
maxYoft = Max[Table[interp, {t, 0, 25, 1}]]
(*finding the t value for max Y this doesn't work.
is there any other ways to do this? instead opf using findroot?*)
tformaxY = FindRoot[interp == maxYoft, {t, 0}]
(*half maximal y*)
halfmaxY = ( maxYoft)/2
(*tfor half maximal y*)
{t, halfmaxY}
tforhalfmaxY = FindRoot[interp == halfmaxY, {t, 0}]
Plot[Evaluate[y[t] /. solution], {t, 0, 25}];
URL: , |
|