フィルターのクリア

How to determine the moment (time) at which the signal exceeded the set value in simulink?

8 ビュー (過去 30 日間)
Marko Boskovic
Marko Boskovic 2021 年 2 月 15 日
編集済み: Jonas 2022 年 8 月 2 日
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?

回答 (2 件)

Jonas
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
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!
Jonas
Jonas 2022 年 8 月 2 日
編集済み: Jonas 2022 年 8 月 2 日
Instead of using an integrator I just used the clock directly.

サインインしてコメントする。


Fangjun Jiang
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 件のコメント
Marko Boskovic
Marko Boskovic 2021 年 2 月 16 日
I can do the same with the block ''MATLAB function'', but I don't get what I want. I want to determine at what point this function exceeds a certain value, and to use that moment as the time when I will call another function (because that other function is not active until that moment). For example I have a function x^2, the function x-2 should be run at the moment when the function x^3 exceeds the value 4, so I need to have number (time when fuction is higher than certain value) on output. How do I determine that moment, can I do that using for or while loop in block ,,MATLAB function''?
Fangjun Jiang
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 ExchangeSources についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by