History in dde23 - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# History in dde23

Posts: 2Member
Hi,

I have not used dde23 before. To try it out I attempted to solve a odefunction which I have already been using with ode23. The function has no delays in it - I'm just using it to check I get the same result BUT I don't (the solutions look very different)!

I'm guessing I'm making a basic error and I suspect its something to do with the history function - the vector I am giving it, [0.5 -0.5 0 0 ], is the same as the initial conditions I used in ode23 (so I want x(1) = 0.5, x(2) = -0.5, x(3) = 0 , x(4) = 0 at t = 0). When I run my code (see below) I don't get these initial conditions??

I have read the dde23 help and tutorial but cant see my error??

Thanks for reading my query

Ed

function sol = delayed
T = 100; % simulation time
DelayForx1 = 1;
DelayForx2 = 1;

sol = dde23(@HKB,[DelayForx1, DelayForx2],[0.5 -0.5 0 0 ],[0, T]);
figure;
plot (sol.x,sol.y)

function dx = HKB(t,x,Z)

alpha = 1;
beta = 1;
gamma = 0.7;
A = -0.3;
B = 0.8;
w=2;

dx(1) = x(3);

dx(2) = x(4);

dx(3) = -(alpha*x(1)^2 + beta * x(3)^2 - gamma)* x(3) - w^2*x(1)...
+ (A + B * (x(1) - x(2))^2)*(x(3)-x(4));

dx(4) = -(alpha*x(2)^2 + beta * x(4)^2 - gamma)* x(4) - w^2*x(2)...
+(A + B * (x(2) - x(1))^2)*(x(4)-x(3));

dx = dx';