필터 지우기
필터 지우기

Increment and decrement counter

조회 수: 17 (최근 30일)
shubham diwate
shubham diwate 2020년 7월 19일
댓글: chaithanya 2023년 7월 27일
Hello,
How to increment counter upto 5 and after reaching to 5 start decrement it till 0 and again start increment from 0 to 5 and from 5 to 0 continuously, by using simulink blocks.
Thank you

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2020년 7월 19일
Use a 'Unit Delay' block. That is the counter. Add a number to it. The number is either 1 or -1.
Use S-R Flip-Flop block to generate the number. Its output is either 1 or 0 but you can multiple it by 2 and then minus 1 to get either 1 or -1.
Compare the counter value with 5 and 0 to get the Set and Reset signal for the S-R Flip-Flop block.
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2020년 7월 20일
All blocks come from Simulink.
chaithanya
chaithanya 2023년 7월 27일
why do we use SR flip flop

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

카테고리

Help CenterFile Exchange에서 Additional Math and Discrete에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by