Change detection using simulink

조회 수: 1 (최근 30일)
Abhibrata Adhikary
Abhibrata Adhikary 2020년 4월 2일
답변: Ameer Hamza 2020년 4월 2일
Hi All,
I need some help buliding a simulink logic for the following case:
  • I have a column with various states changing from 1 to 6 as shown in the below image.
  • And I would like to implement a simulink logic to determine how many samples were there in each state before it changed to a new state.
  • As soon as the state changes, it should reset its counter and start counting the next state
I would be really grateful if you could help me understand on how to approach the problem.
Thanks
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 4월 2일
How do you define samples in this case. Do you mean time-steps?
Abhibrata Adhikary
Abhibrata Adhikary 2020년 4월 2일
yes

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

답변 (2개)

Birdman
Birdman 2020년 4월 2일
I tried to make a model for you, where I tried to build a signal based on your description. Please click on the Signal Builder block and check it. Then, by using Detect Change block, I tried to capture the change in the input signal and with that each change, I reenabled a counter located in a Enabled Subsystem and it started counting again. Please run the simulation and open the Scope in the model. You will see that the counter is reset at every change and where it is reset, in the Scope, you will see that at values 4, 8, 12, 7 and 4, just as in the question, the counter is reset. Check the model and try to understand it and try to adapt it according to your purpose.

Ameer Hamza
Ameer Hamza 2020년 4월 2일
See the attached file. It uses a Stateflow diagram to model the state transition according to the step-sizes in your question.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

제품


릴리스

R2010b

Community Treasure Hunt

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

Start Hunting!

Translated by