Re: Problem with NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg37884] Re: Problem with NDSolve
- From: Selwyn Hollis <hollisse at mail.armstrong.edu>
- Date: Sat, 16 Nov 2002 01:16:07 -0500 (EST)
- References: <200210220847.EAA27452@smc.vnet.net> <ar25in$g4h$1@smc.vnet.net>
- Reply-to: selwynh at earthlink.net
- Sender: owner-wri-mathgroup at wolfram.com
Hi Sergio, If you look at your i2[t] expression, you'll see that it has a term involving DiracDelta[t-.5]. There is no way a numerical algorithm is going to deal correctly with that. Here's a simple, though not totally satisfactory, work-around: First define an approximate Dirac distribution (a pulse with "width" r): nDelta[x_, r_] := (UnitStep[x + r/2] - UnitStep[x - r/2])/r Then replace the DiracDelta function in i2[t] with nDelta: ni2[t_] = i2[t]/.DiracDelta[x_] -> nDelta[x,.001]; NDSolve[{i1[t] == ni2[t], vout[0] == 0}, vout, {t, 0, 10.}, MaxStepSize->.001, MaxSteps->10^5] Note that the setting for MaxStepSize is the same as the width of the pulse. You'll see that the result agrees fairly well with your "physical" solution. --- Selwyn Hollis