MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

NDSolve and MaxStepSize



Dear MathGroup users,

I have found the following naive behavior of NDSolve:

In[1] = tmin = 0 ; t0 = 0.2 ; t1 = 0.5 ; tmax = 1 ;

In[2] = f[t_] = Which[ t < t0 , 0.0 , t <= t1 , 0.5 , t <= tmax , 0  ] ;

(* f(t) is a step function * )

In[3] = solution =

        NDSolve[ { v'[t] == f[t] , v[0] == 0 } , v[t] , {t,tmin,tmax} ,

             , MaxSteps -> 5000 ] ;

In[4] = vsol[t_] = v[t] /. solution ;


vsol(t) is the null function! NDSolve has choosen a maximal step !

To receive the right answer I have to put  MaxStepSize -> 0.01 :


In[5] = solution =

        NDSolve[ { v'[t] == f[t] , v[0] == 0 } , v[t] , {t,tmin,tmax} ,

                MaxStepSize -> 0.01 , MaxSteps -> 5000 ] ;

In[6] = vsol[t_] = v[t] /. solution ;


How can I convince my matlab engineering environment to use mathematica
with such a naive behavior?

See you later.

Fred Lang.




  • Prev by Date: Extension of MatrixExp
  • Next by Date: Changing fonts between environments
  • Prev by thread: Re: Re: Extension of MatrixExp
  • Next by thread: Re: NDSolve and MaxStepSize