Control Simulibk step size through an internal coondition
1 次查看(过去 30 天)
显示 更早的评论
I have implemented some blocks (S-Function level-2 using Matlab code, matlab function block...etc) in simulink, and I have an internal stability condition which will determine the step size after each simulation step. I know that I can set the solver to a variable step solver, but how can I make simulink check for the different obtained step sizes, and then, impose the smallest to all blocks? For the time being , I am using the following trick:
set_param(bdroot,'MaxStep',num2str(dT));
set_param(bdroot,'MinStep',num2str(dT*0.9999));
because the minimum and maximum steps cannot be the same. However, this is not working good enough.
0 个评论
回答(1 个)
Christopher Berry
2014-8-11
Anfanger,
In order for the parameters MinStep and MaxStep to be enabled, the solver Type must be VariableStep. If you are using a fixed step solver, then these settings will just be ignored. So make sure you are using a variable-step solver, like ode45.
Also, I have no problems setting the MinStep and MaxStep to the same values, what error are you getting when you do:
set_param(bdroot,'MaxStep',num2str(dT));
set_param(bdroot,'MinStep',num2str(dT));
Other than that, this method seems like it should work, so what about it specifically is not good enough?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Configure Simulation Conditions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!