NDSolve and MaxStepSize
- To: mathgroup@smc.vnet.net
- Subject: [mg11671] NDSolve and MaxStepSize
- From: lang@einev.ch (Fred Lang)
- Date: Sat, 21 Mar 1998 18:35:08 -0500
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.