Modify the state variable in a Level-1 MATLAB S-Function

8 vues (au cours des 30 derniers jours)
Lotfi
Lotfi le 1 Oct 2019
Hi
I want to integrate the pulsation to obtain an angle but I must keep this angle between -pi to pi.
I use
function sys = mdlOutputs(t,x,u)
if(x>pi)
x=x-2*pi;
end
sys = x;
but the correction is only made once in the beginning of the simulation, then, x (the angle) is no longer put again to the range -pi to pi
Why is the solver not updating correctly x
Thanks
  1 commentaire
Daniel Sánchez Molina
Daniel Sánchez Molina le 14 Juil 2022
Hi, did you solve this? I tried but without succes.
Thanks,

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by