Borrar filtros
Borrar filtros

Unable to meet integration tolerances without reducing the step size below the smallest value allowed

4 visualizaciones (últimos 30 días)
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 comentarios
Daniel Borrus
Daniel Borrus el 23 de Mayo de 2016
I fixed it. The issue lay in my learning how to vectorize a system of equations. I was treating the system of equations like they were repeating. But when writing something like y(1:en:N) in the equation the new vector created was not on the bottom of the system, but rather right below that specific equation is was used in. This threw off my ODE and created one that acted nothing like a lorenz equation, but something that rushed to inf very quickly. An impossible task for the ODE solver after a few time clicks.
Woot woot!
Hagai Kiri
Hagai Kiri el 20 de Ag. de 2018
Editada: Torsten el 20 de Ag. de 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?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by