Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only

History in dde23 Posted by edrookie on 24 Sept 2012 at 9:03 AM
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';

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.