Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.2K Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

NDSolve and difference of delays argument for heaviside function?

Posted 10 years ago

I'm trying to us NDsolve to solve a system of ODEs that involves a delay difference as the inside of a heaviside function. Things run fine when the argument of the heaviside is y[t] or y[t-2], but when the argument is y[t]-y[t-2] I get an error about the initial condition not being in the range specified by the discrete variable. Does anyone know how to fix this or of a work-around? I'm quite a novice when it comes to Mathematica - I appreciate any help you can offer! Thanks!

In[1]:= f[x_] := x*UnitStep[x - 2]

In[2]:= Function[x, x UnitStep[x - 2]]

Out[2]= Function[x, x UnitStep[x - 2]]

In[3]:= Dx = x'[t] == f[y[t] - y[t - 2]]

Out[3]= Derivative[1][x][t] == 
 UnitStep[-2 - y[-2 + t] + y[t]] (-y[-2 + t] + y[t])

In[4]:= Dy = y'[t] == z[t]

Out[4]= Derivative[1][y][t] == z[t]

In[5]:= Dz = z'[t] == Sin[t]

Out[5]= Derivative[1][z][t] == Sin[t]

In[6]:= NDSolve[{Dx, Dy, Dz, x[0] == .1, y[t /; t < 0] == 0, 
  z[0] == 0}, {x, y, z}, {t, 0, 10}]

During evaluation of In[6]:= NDSolve::ihist: Conditions given at t = 0.` will be interpreted as initial history functions for t/;t<=0.. >>

During evaluation of In[6]:= NDSolve::ndinid: Initial condition Sign[-2.-1. y$341] is not in the range specified by the discrete variable NDSolve`s$343. >>

Out[6]= NDSolve[{Derivative[1][x][t] == 
   UnitStep[-2 - y[-2 + t] + y[t]] (-y[-2 + t] + y[t]), 
  Derivative[1][y][t] == z[t], Derivative[1][z][t] == Sin[t], 
  x[0] == 0.1, y[t /; t < 0] == 0, z[0] == 0}, {x, y, z}, {t, 0, 10}]
POSTED BY: Zahava Wilstein
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard