How can I get the instantaneous step size value in variable step solver at a simulink model?

Hello everyone,
This is an urgent stuation. I got a proble to get the value of instantaneous step size value in variable step solver. In my simscape model there is also a runge kutta solver function that I wrote and I need a h value which is a h=step_value/10. I dont want to use fixed step solver. That is why I need to know step value for each time step. I would be appreciated if you help me.

답변 (1개)

Hi, you can use the "Clock" block in Simulink to get the current simulation time and the "memory" block to store this value for each step. In each step, subtract the output of "Memory" block (i.e. previous time step) from the current output of "Clock" to get the current step size. Here is a sketch of the workflow:
I hope this helps!

댓글 수: 4

Thank you for your suggestion.
Actually, I need to know the step size for the time I'm in (Present time step). Is there any way to write the present time step size. However, I will try your suggestion.
What step size do you expect at time 0 ?
Now I am using fixed variable and my stepsize value is 0.001. (fixed_step_size=0.001)
My model calculates next step's X value with Runge Kutta 4 and runge needs its own step size (h).
In my current model I calculated h= fixed_step_size/10.
After RK4 is calculated X, I use X as a input of the next step. This is the loop like that.
I want to do this with variable step size but I couldn't find a way to get Present time step.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 General Applications에 대해 자세히 알아보기

질문:

2021년 5월 4일

댓글:

2021년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by