How can I implement runge kutta method to a control problem in Simulink ?

조회 수: 9 (최근 30일)
Dogan Yildiz
Dogan Yildiz 2022년 11월 5일
댓글: Yuichiro Aoyama 2024년 2월 16일
Hello Everyone,
I have a question about the implementation of the Runge Kutta method in a control system. I have used a general inverted pendulum problem with a PID controller. What I want to achieve is trying to write my Runge Kutta code and compare it with Simulink ode4 solver. The point that I am stuck is the implementation of Runge Kutta with a control input. The general version of Runge Kutta shows only half and one time step ahead with state variables of ODE. However, in a control problem, you need to calculate the control input at and where h is time step. Somehow Simulink handles this problem and I couldn't find how Simulink calculates and approximates future control input values.
I have tried to calculate one step ahead control input and interpolate the control input value between and . The results are quite similar but they don't coincide with each other. I have shared the results below.
Could you please help me, how should we implement the control input to calculate in advance in the Runge-Kutta method? And Do you have knowledge about how Simulink calculates and implement control input when we select the ode4 solver selection?
  댓글 수: 4
Kristof
Kristof 2022년 11월 15일
I have the same problem, I am looking for a general soulution to this situation. I tried to do the following: I took the derivative of the input force (from the current and the previous value), and predicted the future by that. But it is tricky, that my PID evaulates a new input force by its own selfprediction?
Yuichiro Aoyama
Yuichiro Aoyama 2024년 2월 16일
I am not sure if this is answering the question, but in the vido below, the same u(t) is used all over the integration interval and works well.
https://www.youtube.com/watch?v=OOL5Mo_jYGY

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

답변 (0개)

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by