Effacer les filtres
Effacer les filtres

Convert range of signal values to constant by Simulink

13 vues (au cours des 30 derniers jours)
cyberdyne
cyberdyne le 25 Mai 2011
Hi,
I need a block system which outs a constant when signal varies between 2 values and only for a finite time range.
for example if signal varies between 3 and 4 for 7 seconds, output must be a constant. But if signal varies between 3 and 4 for 2 seconds, output must be 0.
How can i get it ?
thanks

Réponses (3)

Arnaud Miege
Arnaud Miege le 26 Mai 2011
You can also use a Stateflow chart to construct your logic algorithm.
Arnaud
  1 commentaire
cyberdyne
cyberdyne le 26 Mai 2011
I'll try also this method. Thanks!

Connectez-vous pour commenter.


Fangjun Jiang
Fangjun Jiang le 25 Mai 2011
I don't think there is a readily available block that can do the task for you. But I think you can construct a system to do that.
Construct a logic to compare your signal value. If it is between 3 and 4, the output is true (1). Otherwise, it is false (0). Feed this output to an Integrator block. The trick is to enable the "External reset" for the Integrator block. If the logic output is true (1), it keeps integrating. If the logic output is false(0), you can use this signal to reset the Integrator block so the output of the Integrator block will be reset to zero.
Now compare the output value of the Integrator block. If it is equal to or greater than 7, it means that your signal value has been continuously between 3 and 4 for at least 7 seconds, you can output the constant that you want. Otherwise, your output is zero.
All these numbers, 3, 4 or 7 can be made to be variables so you can tune them.
  4 commentaires
Fangjun Jiang
Fangjun Jiang le 25 Mai 2011
The first input to the Integrator block is the logical output of comparing your signal value with 3 and 4. The second input (External reset) of the Integrator block could be the opposite (use NOT logical operator) of that logical output. If everything is default, the Integrator should take the signal. But if not, you can specify the logical output as double, or use a data type conversion block.
cyberdyne
cyberdyne le 25 Mai 2011
Thanks!

Connectez-vous pour commenter.


Mohamed Mahmoud
Mohamed Mahmoud le 20 Avr 2023
One way to achieve this is by using a comparator circuit and a timer circuit. Here's an example circuit that could work:
  1. Use a comparator circuit to compare the input signal with the upper and lower threshold values (in this case, 3 and 4). When the input signal is between these two values, the output of the comparator will be high.
  2. Connect the output of the comparator to a timer circuit (e.g. a 555 timer). When the output of the comparator goes high, the timer will start counting.
  3. Set the timer to output a high signal only when it has counted for the desired time range (e.g. 7 seconds). When the timer output goes high, the output of the overall circuit will be high, indicating that the input signal was within the desired range for the required time period.
  4. If the input signal goes outside the desired range before the timer has finished counting, the output of the timer will go low and the overall circuit output will also go low.
Note that the exact circuit components and values will depend on your specific requirements and the characteristics of your input signal. Additionally, you may need to add some additional signal conditioning or filtering to ensure that the comparator circuit works correctly.

Catégories

En savoir plus sur Schedule Model Components dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by