필터 지우기
필터 지우기

How to save the initial value of a variable ? (Simulink)

조회 수: 68 (최근 30일)
CamG52
CamG52 2018년 7월 11일
댓글: CamG52 2018년 7월 11일
Hello everyone,
I have two position variables x and y that change everytime my vehicle moves. What I would like is to save the initial value of x and y in order to use it in a function using Simulink. However, I can't use the block 'save to workspace' because you have access to the variables at the end of the simulation and I need them during the simulation.
I tried with 'Tapped delay' too but the value of the variables change.
Thank you very much for you help and have a nice day !
Camille

채택된 답변

goerk
goerk 2018년 7월 11일
You can just 'Sample And Hold' the signal at the first tick.
A 'Sample and Hold' is basically only a triggered subsystem where the output is connected to the input.
You can also use a switch and a unit delay to implement the same functionality. (Switching signal is true only for the first tick, switch inputs is the signal and the delayed output)
  댓글 수: 1
CamG52
CamG52 2018년 7월 11일
I used the 'Sample and Hold' with a step function as trigger and it works very well !
Thank you very much !

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by