Mega Search
23.2 Million


Sign Up

Make a donation  
MATLAB  
News Group: comp.soft-sys.matlab

%vandana paper
function dr=vandana(t,r,Z);
dr=zeros(3,1);
l=.7;
a=.2;
a1=.7;
m=.7;
n=.2;
d1=.2;
x=.2;
a2=.5;
y=.8;
M=10;
rlag1=Z(:,1);
rlag2=Z(:,2);
dr1= r1*(l-a*r1-(a1*r3)/(1+M*r1));
dr2=m*r3-n*r2-m*exp(-d1*ta)*rlag1(2);
dr3=-x*r3+m*exp(-d1*ta)*rlag1(2)+(a2*rlag2(1)*rlag2(3))/(1+M*rlag2(1))-y*r3*r3;
drdt = [ dr(1)
         dr(2)
         dr(3)
         ];
This is the code and it is showing the following error:

sol =dde23(@vandana,[0 10],[20, 10 10],[1 1.5]);
 Error using ==> dde23 at 142
The lags must all be positive.
  Can anyone help me in this?

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 26-Aug-2016, at 8:49 AM EST
From: Sudipa
 
Re: MATLAB  
News Group: comp.soft-sys.matlab

"Sudipa"  wrote in message 
news:npovpv$slt$1@newscl01ah.mathworks.com...

*snip*

> This is the code and it is showing the following error:
>
> sol =dde23(@vandana,[0 10],[20, 10 10],[1 1.5]);
> Error using ==> dde23 at 142
> The lags must all be positive.
>  Can anyone help me in this?

Look at the help for the DDE23 function. The order of the input arguments 
(in particular the location of the TSPAN input argument) is not the same for 
the DDE solvers as for the ODE solvers. As you've written it, you're trying 
to solve:

y'(t) = f(t, y(t), y(t-0), y(t-10)) or

y'(t) = f(t, y(t), y(t), y(t-10))

If instead you want to solve:

y'(t) = f(t, y(t), y(t-1), y(t-1.5))

move [1 1.5] to be the second input to DDE23 rather than the fourth, specify 
the history as the third input, and specify your time span as the fourth.

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 


Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 26-Aug-2016, at 9:53 AM EST
From: Steven Lord