필터 지우기
필터 지우기

Convert range of signal values to constant by Simulink

조회 수: 13 (최근 30일)
cyberdyne
cyberdyne 2011년 5월 25일
답변: Mohamed Mahmoud 2023년 4월 20일
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

답변 (3개)

Arnaud Miege
Arnaud Miege 2011년 5월 26일
You can also use a Stateflow chart to construct your logic algorithm.
Arnaud

Fangjun Jiang
Fangjun Jiang 2011년 5월 25일
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
Fangjun Jiang
Fangjun Jiang 2011년 5월 25일
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 2011년 5월 25일
Thanks!

댓글을 달려면 로그인하십시오.


Mohamed Mahmoud
Mohamed Mahmoud 2023년 4월 20일
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.

카테고리

Help CenterFile Exchange에서 Schedule Model Components에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by