How to script the ON/OFF delays in matlab?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello all, can some one help me to figure out this :
When the input becomes false, the output becomes false after a preset time delay. The output remains false as long as the input is false.
When the input is true or becomes true, the output is true with no delay.
There is On/Off Delay block available in simulink library, but i would like to have it in matlab code.
4 comentarios
Vladimir Bessonov
el 13 de Jun. de 2020
I needed it for debouncing?
I was looking how I can implement somethign similar to what I did in IBA - Analyzer
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/315498/image.png)
Walter Roberson
el 13 de Jun. de 2020
these days stateflow toolbox can be called from MATLAB
https://www.mathworks.com/help/stateflow/ug/debouncing-signals.html
Respuestas (1)
Walter Roberson
el 13 de Jun. de 2020
delay_to_false = 10;
dc = -1;
while true
insamp = get_input() ;
if ~islogical(insamp); break; end % end of input signalled
if insamp
dc = delay_to_false;
end
dc = dc - 1;
outsamp = dc >= 0;
output_sample(outsamp) ;
end
0 comentarios
Ver también
Categorías
Más información sobre Stateflow en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!