MATLAB Answers

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

2 views (last 30 days)
Thomas Schütz
Thomas Schütz on 20 Oct 2020
Answered: Fangjun Jiang on 20 Oct 2020
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

  0 Comments

Sign in to comment.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 20 Oct 2020
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.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!