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

时间:2024-04-08 11:16:39

解决

这个报错一般还伴随着警告algebraic loop(代数环)存在。看似是s函数的报错,实则问题不出在这,而是出在仿真步长上,我的模型再输入10都是正常的,上100就报错,显然模型应该是不存在问题的。这也是我锁定问题应该在simulink求解方法上而不是模型上的原因。

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

解决方案:
将模型设置为固定步长,且步长取小一些:
Simulink报错:State derivatives returned by S-function ‘xx‘ in ‘untitled/S-Function‘ during flag = 1...