필터 지우기
필터 지우기

How to script the ON/OFF delays in matlab?

조회 수: 5 (최근 30일)
Bharath Kumar S
Bharath Kumar S 2019년 10월 16일
댓글: Walter Roberson 2020년 6월 13일
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
Vladimir Bessonov
Vladimir Bessonov 2020년 6월 13일
I needed it for debouncing?
I was looking how I can implement somethign similar to what I did in IBA - Analyzer
Walter Roberson
Walter Roberson 2020년 6월 13일
these days stateflow toolbox can be called from MATLAB
https://www.mathworks.com/help/stateflow/ug/debouncing-signals.html

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

답변 (1개)

Walter Roberson
Walter Roberson 2020년 6월 13일
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

카테고리

Help CenterFile Exchange에서 Stateflow에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by