Using ode4 solver in a sliding mode controller
Afficher commentaires plus anciens
Hello,
I did a xls model in simulink and a matlab script for a SMC controller and I was expecting the same resutl for both, but is not exactly the same. After looking for both programs, I realized that I'm using a ode4 solver in the simulink xls and seems for me that this is the main issue (I saved the time vector from simuink and use it in the .mat, the results where the same)
I'm quite lost with ode's in matlab, and more if I have to solve this control algorithm... Please How can I use ode4 in my matlab script? I have searched in the forum and in matlab help and I have found this link, but I dont get the point on how to use the function:
I see that ode uses this fucntion to work where I have to use my starting time, time step, final time and initial conditions. I'm lostwith the F function part. I dont know how can I integrate this in my code.
yout = ODE4(F,t0,h,tfinal,y0)
attached bot scripts, Thanks in advance!
3 commentaires
Hi @Mikel
Correct me if I'm wrong. In SMDOB_X2_observer.m, the disturbance is disabled
, and the input is changed to
so that I can compare with the standard response of a stable mass-spring-damper-like system:

The solution for
. But the response from your code looks different from the analytical solution.
. But the response from your code looks different from the analytical solution.y = @(t) exp(-t).*(1 + t);
fplot(y, [0 10]), grid on
xlabel('t'), ylabel('x_{1}')
When I run your integration code in SMDOB_X2_observer.m, the supposedly stable mass-spring-damper system becomes unstable.
Mikel
le 4 Avr 2023
@Mikel, Thanks for your reply.
Have you tested the system using the ode45() solver?
I understand that the sinusoidal disturbance
is always active. I purposely set
to simulate the response of a Double Integrator under the influence of a full-state feedback input
.
This allows me evaluate whether integration code in the m-file works as expected or not.
Using your integration code, the states appears to grow and oscillates after 40 seconds (significant to human eyes), and they explode after 60 seconds. However, this test system should be stable.

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Classical Control Design dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








