Hi,
I have the following problem with code on the sliding mode control, solving a non linear problem:
running the code, I do not have errors or warning, the integration starts, but does not end, looks like enter in a sort of infinite loop.
Showing some result in the function and running I realized that:
-- with a tollerance about 1e-13 (I always use this), the results are always equal, so the integration carries on always the same result and it will not go on,
-- reducing thetollerance at 1e-5 , I change see results that change, but integration never end, maybe go to converge, but soon starting to converge.
these happen even if I use a small intervall time.
many many thanks for your time and help
best regards

 Réponse acceptée

darova
darova le 3 Avr 2020

0 votes

I tried
tt = [0 1];
options=odeset('RelTol',1e-3,'AbsTol',1e-3);

4 commentaires

darova
darova le 3 Avr 2020
I suggest you to use structure instead of global variables
S.J = J;
S.rho1_0_costante = rho1_0_costante;
S.sigma1 = sigma1;
S.lambda1 = lambda1;
S.L = L;
[t,X] = ode113(@eq_moto_assetto,[0 1],cond_in,options,S);
and function
function [ derivate ] = eq_moto_assetto(t, X ,S)
J = S.J;
rho1_0_costante = S.rho1_0_costante;
sigma1 = S.sigma1;
lambda1 = S.lambda1;
L = S.L;
Alessandro Vitiello
Alessandro Vitiello le 4 Avr 2020
Thank you very much, now run, but does not work, so I suppose something wrong in the equations.
just a little question, why do you suggest to use structure instead of global ?
Again, many many thanks for your time and consideratoins
best regards
darova
darova le 4 Avr 2020
  • now run, but does not work
Don't understand?
  • why do you suggest to use structure instead of global ?
Im not an experinced programmer but only heard a lot not to use global variables
Some links: LINK1, LINK2
Alessandro Vitiello
Alessandro Vitiello le 4 Avr 2020
thanks for the links.
now run, but does not work : in the sense that the code compile ( no error, no warning) but the results are wrong, their are not what I expect, errors should go to zero, (I integrate for longer time) . I do not know if it occurs because the tollerance is too small ( in gereral I use 1e-13) or because there is a bug error in the model, maybe the second.
By the way, thank you again for your help.
regard

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by