필터 지우기
필터 지우기

How to change variables in time in Simulink?

조회 수: 27 (최근 30일)
Evgheny
Evgheny 2011년 4월 20일
I have some processing (moving of wheelset). Wheelset has mass, it's variable and it's declaring in init.m file (for example M=1;)
Now I want that in this proccess mass of wheelset will be changed every 2 seconds. How to save the new value of mass to M variable from Simulink?

채택된 답변

Jarrod Rivituso
Jarrod Rivituso 2011년 4월 21일
It sounds to me like you want the mass data to be a signal, and not a parameter that is defined by a workspace variable.
I think of Simulink as having data which are either signals or parameters:
  • Signal - value updates during simulation time
  • Parameter - value does not change unless user manually changes it
To get a mass that changed every two seconds, I would define the mass as an input signal derived from one of the Source blocks (Simulink -> Sources library) such as Inport, From Workspace, Signal Builder, etc.
  댓글 수: 1
Evgheny
Evgheny 2011년 4월 21일
I've made `Const Block` with M value and then `Fcn Block` with inputs of `M` and `time` and output of a new `M`. This new `M` I gave to all blocks I needed (early I haven't `M` in model - it was taken from workspace, but now it is signal)

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by