Question: odeplot with automatically adjusting time

Hi everyone, I have a question regarding the time in a plot.

The idea behind is, that i dont have to adjust the time after every change of parameters.

I have a function that only is valid until a certain time. I evaluete the time until cut off for example like this:

tempLrest := Optimization:-Minimize(tempLrest(t), t = 0 .. 2);
              tempLrest := [2.47883089786094 10^-8  , [t = 0.414486068771508]]

cutoff := tempLrest[2];

Now i want to call "cutoff" in an odeplot like this: 

odeplot(sol1, [t, z(t)], 0 ..cutoff , size = [300, 300])

unfortunately this doesnt work. 

Does everyone know how to solve this problem?

Thank you in advance!

Please Wait...