Problems with ode23s
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have this warning on matlab
Warning: Failure at t=4.447832e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.580187e-14) at time t.
the important code is this and i dont know how to solve it:
t0 = 0.001;
tf = 144;
Opciones = odeset('RelTol', 1e-4, 'AbsTol', 1e-7);
[t,X] = ode23s('SedimenEstNN', [t0,tf], [X(1) X(2) X(3) X(4)...
X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14)...
X(15) X(16) X(17)], Opciones);
function dX=SedimenEstNN(t,X)
global A H K N P Va be
U = SedimenEntNN(t);
Qd = P*U(1);
Eda = Va*U(2)/(24*Qd*X(16));
dX(17) = Eda;
Edad =X(17)/t;
%more code...
function U=SedimenEntNN(t)
global A H K N P Va be
A = 200; H = 2; K = 7e-13;
N = 6; be = 2.2; Va = 600;
w = 2*pi/24*(t-10);
R = 0.75;
P = 0.0156;
if t>118
U(1) = 100; U(2) = 2500; U(3) = R*U(1);
else
U(1) = 100 + 50*sin(w);
U(2) = 2500 + 500*sin(w);
U(3) = R*U(1);
end
thank you before all and if i need to put more code tell me please
1 Kommentar
Jan
am 26 Sep. 2017
[X(1) X(2) X(3) X(4)...
X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14)...
X(15) X(16) X(17)]
?? What about:
X(1:17)
Antworten (2)
Torsten
am 26 Sep. 2017
Bearbeitet: Torsten
am 26 Sep. 2017
It's hard to tell why ode23s fails for your problem.
Some options how to proceed:
1. Make sure that you transposed the dX-array at the end of function "SedimenEstNN".
2. The vector of initial guesses [X(1) X(2) X(3) X(4) X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) X(16) X(17)] should be a column vector, not a row vector. Did you give values to the X(i)'s before you called ode23s ?
3. Check the solution up to the time where the solver fails.
4. Check the dX values at the time where the solver fails.
5. Choose smaller tolerances.
6. Try a stiff solver (e.g. ode15s).
Good luck.
Best wishes
Torsten.
Jan
am 26 Sep. 2017
[X(1) X(2) X(3) X(4)...
X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14)...
X(15) X(16) X(17)]
?? What about:
X(1:17)
Do not provide the function to be integrated as string 'SedimenEstNN', but as function handle @SedimenEstNN. This is the preferred method since Matlab 6.5 (over 15 years now...).
The function to be integrated is not smooth at t=118. This is a really bad idea and Matlab's integrators are not designed to handle such jumps. See http://www.mathworks.com/matlabcentral/answers/59582#answer_72047
Use the reached time as endpoint and look at the trajectory:
t0 = 0.001;
tf = 4.447832e+00 - 10 * eps(4.447832);
Opciones = odeset('RelTol', 1e-4, 'AbsTol', 1e-7);
[t,X] = ode23s('SedimenEstNN', [t0,tf], [X(1) X(2) X(3) X(4)...
X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14)...
X(15) X(16) X(17)], Opciones);
plot(t, X); % Or X.'? I cannot remember this detail
Do you see a pole? If so, it is a mathematical problem and not a fault of the integrator.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!