How to hold a value in simulink ?
조회 수: 141 (최근 30일)
이전 댓글 표시
Arthur MONVOISIN
2021년 10월 25일
답변: CHANDRA BABU GUTTIKONDA
2025년 8월 12일 11:19
Hello,
I search how to hold a value in my simulink model for an operation : I need to keep the latest value of my model and then add it to my signal until the input signal get to 0 again. It is like a vertical translation of my signal by the latest value calculated in the latest period.
Something like that : 

Can a block in simulink do that or hold the latest value to add it to all the next iteration ?
Here is my simulink model :

K has the value 12.
A1 has the value 9.5e-5.
In input I have a custom repeating sequence from the fonction in the m file (force.m) : 

I'm sorry for the size of each screen capture, I don't know how to manage it.
Thank you for your time.
댓글 수: 0
채택된 답변
추가 답변 (1개)
CHANDRA BABU GUTTIKONDA
2025년 8월 12일 11:19
In Simulink, you can hold the latest value of a signal until a reset condition (like the signal crossing zero) by using a zero-crossing or change-detection block to trigger a subsystem that stores the value in a Memory or Unit Delay block; this stored value is then continuously added to the live signal through an Add block, effectively applying a vertical shift that updates only at each trigger event, keeping the offset constant between events until the input hits zero again.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!