How to Hold the sensor values for 10s and update the output value (boolean) using simulink
1 次查看(过去 30 天)
显示 更早的评论
I receive value from temperature sensor continously at 100ms step size.
If the value from sensor is same for continous 10s, then the output value should be 1
If the value from sensor is not same, then the output value should be 0.
Can anyone help me on this with the simulink design or atleast the blocks to be used to hold the values for 10s
0 个评论
回答(1 个)
Fangjun Jiang
2023-5-9
Use a Unit Delay block to store the previous value. I assume that is what you will use to compare "If the value from sensor is same".
The comparison will generate a TRUE or FALSE signal. Feed this signal to an Integrator block, which has its Reset option enabled. If the comparison output is FALSE, use it to reset the integrator. The comparison output is also always feed into the input of the integrator. If the comparison is always TRUE, the output of the integrator will keep increasing. Compare it with 10, you will get the desired output.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!