Use Simulation Time of Simulink in Matlab function when threshold is exceeded

7 次查看(过去 30 天)
Hello everybody,
I am currently having a problem with a matlab function which I want to implement in my Simulink Project. In this Matlab function, I want to create some sort of pulse train. Here, the incoming signal has to be compared to a threshold value (here 10000) at a specific time (here 1.7µs). If the incoming signal exceeds the threshold at the reference time of 1.7µs, a pulse train has to be created. This pulse train outputs a 1 every 0.8µs starting at 1.7µs. The pulse width is not of importance as I want to use this signal as a trigger for a sample and hold block afterwards. If the incoming signal does not exceed the threshold at 1.7µs, the output has to stay at 0. The problem now is that I dont know how to implement this.
Thank you in advance,
Thomas

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2020-10-20
Use Step block to specify time and value. This is your threshhold.
Use Comparator block to compare your incoming signal with this threshold. Use the output to control a Switch block.
Switch between whatever value and 'simulink/Discontinuities/PWM' block.

类别

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