Changing value of variable while simulation is running

조회 수: 39 (최근 30일)
Surya  S
Surya S 2023년 2월 16일
답변: Oguz Kaan Hancioglu 2023년 2월 17일
How can I change the value of a variable in a mathematical model while the simulation is running?
  댓글 수: 1
Mathieu NOE
Mathieu NOE 2023년 2월 16일
hello
can you be more precise ? do you have a code to share ?

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

답변 (1개)

Oguz Kaan Hancioglu
Oguz Kaan Hancioglu 2023년 2월 17일
You can connect all input variables with the input block including model variables. After that, you can connect the Simulink inputs to the workspace using Data Import/Export screen in the configuration parameters. You can create an input vector with respect to time and Simulink updates the input vector using the time variable.
You can use the set_param function to change the value of each block during the simulation. However, it is really hard to make changes with respect to time. You need to add some extra logic, and Matlab functions in your Simulink file.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by