How to determine the moment (time) at which the signal exceeded the set value in simulink?
조회 수: 8 (최근 30일)
이전 댓글 표시
If I have a signal defined by exponential function (for example): 2e^t. How do I determine time when the value of this function will be more then (for example) 5?
댓글 수: 0
답변 (2개)
Jonas
2021년 2월 15일
Put an integrator block with input 1 inside an enabled subsystem. Use a relational operator to see if your exponential function value is above 5 and use it for the enable port of the enabled subsystem. The output of the integrator will give you the time.
댓글 수: 4
Tiago Moraes
2022년 8월 2일
Explaing the example:
Inside subsystem we have an integrator. Simulation time: 12s.It's generated a pulse with period 4s and pulse width 22%. So, per clicle, the pulse is high during 0,88s. In 12s, we have 3 cycles. So, the integrator result is 2,64s (3 x 0,88s). It works!
Fangjun Jiang
2021년 2월 15일
Assume you build your model correctly, your signal varies as time goes. Compare your signal with the Constant value, its output will be a true or false signal. Use this signal to trig a tiggered subsystem, which contains a Clock block inside. Play with it and you should be able to get what you want.
댓글 수: 2
Fangjun Jiang
2021년 2월 16일
I can see that it can be done using a MATLAB Function block, but no need to use FOR or WHILE loop. Keep in mind that the MATLAB Function block is executed at every simulation step.
Did you try the method I suggested? That is a more straightforward method.
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!