I want to numerically solve the following system of diff. eqns:
dx/dt = y
dy/dt = z
dz/dt = -y + x^2 - 0.025
where d is a constant.
The initial point is [0.5,0.5,0.5]
I have tried both stiff and nonstiff ODE solvers to no avail. The system always diverges to huge values and the following error pops up:
"Warning: Failure at t=2.660704e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.105427e-15) at time t."
I have tried changing the eps value but it is not of much help.
A theoretical analysis shows that the system should not diverge. What do you guys suggest I do? The code that I used:
function [x,y,z] = system2(d ,initV, T, eps)
if nargin<2
eps = 0.000001;
T = [0 25];
initV = [1.5 1.55 1.5];
end
options = odeset('RelTol',eps,'AbsTol',[eps eps eps/100]);
[T,X] = ode23tb(@(T,X) F(T, X, d), T, initV, options);
plot3(X(:,1),X(:,2),X(:,3));
axis equal;
grid;
title('System2');
xlabel('X'); ylabel('Y'); zlabel('Z');
x = X(:,1);
y = X(:,2);
z = X(:,3);
return
end
function dx = F(T, X, d)
dx = zeros(3,1);
dx(1) = X(2);
dx(2) = X(3);
dx(3) = -X(2) + X(1)^2 - d;
return
end