Simulink报错:State derivatives returned by S-function ‘xx‘ in ‘untitled/S-Function‘ during flag = 1...

solve

This error is usually accompanied by a warning that algebraic loop (algebraic loop) exists. It seems to be an error of the s-function, but in fact the problem does not lie in this, but in the simulation step size. It is normal for my model to enter 10 again, and an error is reported at 100. Obviously, there should be no problem with the model. This is also the reason why I locked the problem in the simulink solution method instead of the model.

Error screenshot:
Insert picture description here

solution:
Set the model to a fixed step size, and choose a smaller step size:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43145941/article/details/109705711