MATLAB Answers

How to allow only sequences that have had the same value for 5 seconds (in Simulink)?

조회 수: 1(최근 30일)
black_cat
black_cat 2021년 9월 21일
편집: black_cat 2021년 9월 22일
I have an input like this:
[2, 2, 2, 2, 3, 2, 2, 2, 3, 4, 4, 4, 4]
I want to suppress oscillation and only allow sequences that have had the same value for x seconds (e.g. 5). So that it outputs the above sequence like this:
[2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3]
Is there a way to do this using blocks in Simulink?
  댓글 수: 5
black_cat
black_cat 2021년 9월 21일
Yeah, because you assume that the consecutive number is coming from the input, but it is about the output.

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

답변(1개)

Jonas
Jonas 2021년 9월 21일
Using only blocks, I think this should do the trick:
  댓글 수: 1
black_cat
black_cat 2021년 9월 22일
Thank you very much. This is the solution that solved my problem:
However, this only helps me with the values that occurred in the last 5 seconds. Does anyone know how can I apply this to the last 50 seconds without adding 40 more delay blocks?

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by