Unable to meet integration tolerances without reducing the step size below the smallest value allowed
Show older comments
Hello,
I am trying to integrate a non-linear differential equation. But I am getting an error I have never gotten before. "Warning: Failure at t = 4.044553e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (8.881784e-16) at time t."
Is there a way for me to reduce the minimum step size allowed for the ode solver (in this case ode45)? The system is the lorenz equations, ( three equations) , and the system is not stiff. I have tried ode15s and a few others and I am getting the same type of warning. The integrator stops within a few very small time clicks. Why is the integrator doing this?
Here's my code
%%Lorenz Water Wheel Equations
clear
close all
clc
% Parameters
s = 10; % angle of rotation (s = 10)
r = 28; % radius of the wheel (r = 28)
b = 2.5; % xxxx (b = 2.5)
n = 2; % Number of cells
en = 3; % Number of equations
N = n * en; % Total number of equations
% Initial Conditions - Sensitive Dependence on Initial Conditions!
i1 = 1;
i2 = 3;
i3 = 1;
Y0 = [i1;
i2;
i3 ];
Y_actual = repmat(Y0, n,1 );
% Time
tMin = 0; %Initial t
tMax = 100; %Final t
tStep = .01;
time = tMin:tStep:tMax-tStep;
% Equations
df = @(t, y) [s.*(y(2:en:N)- y(1:en:N))
r.*y(1:en:N) - y(2:en:N) - y(1:en:N).*y(3:en:N)
y(1:en:N).*y(2:en:N) - b.*y(3:en:N)];
% Integrater
[T,Y] = ode45(df, time, Y_actual);
figure
plot(T,Y(:,1:en:N),'r', 'LineWidth', 2)
The problem goes away when I reduce the number of cells to 1, but I am learning how to vectorize my matlab scripts so I am really trying to get multiple cells integrated at once.
Thank you, and anything someone could tell my about why the script is doing this would be very helpful. Also, any ways to lower the minimum step size allowed for the ode solver would be great. :)
2 Comments
Daniel Borrus
on 23 May 2016
Hagai Kiri
on 20 Aug 2018
Edited: Torsten
on 20 Aug 2018
i can see it's been two years, but i'm having an almost identical problem,
ODE_options = odeset('RelTol',10^(-8),'AbsTol',10^(-8), 'MaxStep', T/10);
pwr = 0:1:9;
mlt = 10.^(pwr(:));
delta_vec = mlt*gamma_q;
for ii = 1:length(delta_vec)
delta = delta_vec(ii);
[t, p] = ode45(@(t, p) odefcn_uncoupled_fixed(t, p, beta, gamma_p, delta, omega), [0; t_end], [0; 0.1*A_LC_p], ODE_options);
function dxdt = odefcn_uncoupled_fixed(~, x, beta, gamma, delta, omega)
dxdt = zeros(size(x));
dxdt(1) = x(2);
dxdt(2) = (beta-gamma*((x(1))^2)+delta*((x(1))^4))*x(2)-(omega^2)*x(1);
end %function dxdt = odefcn_uncoupled_fixed(~, x, beta, gamma, delta)
and i do not understand what you wrote about solving it, do you remmebr and would you mind explaining?
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!