필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Matlab code generation. Iterate cycle on a vector.

조회 수: 1 (최근 30일)
luca
luca 2019년 7월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi to everybody,
I have a given vector with the following value V = [ 3 1 3 1 2 1 3] and the task is to write a code that is able to do this:
1 2 and 3, in the vector V, represent the entities that a machine can work. The machine can work 2 different entities without making a set up change, when a third different entity is entering the system, we have to change the configuration of the machine (set up time is needed). The vector V describe the entites that are entering in the machine. The situation is this:
1) The first entity that enter is 3 (as can be seen in V). The machine is empty. So the first value of a new vector X should be 0. (0=no set up)
2) The second entity is 1. The machine can work up to two different entities withouth making a set up. So we have another free space. So the second value of the new vector X should be 0. (0=no set up)
3) The third entity is 3. Due to the fact that 3 was already machined before, no set up change is needed. So the third value of the new vector X should be 0. (0=no set up)
4) The fourth entity is 1. Again 1 have been already machined. So the fourth value of the new vector X should be 0. (0=no set up)
5) NOW 2 is entering the machine. Till now 3 and 1 have been worked, so in this case we need a set up change.What happen in the real case is that the older entity (3) will be removed to free up space for the new one (2). If we take a look at the system we see that 1 is the last entity that entered the system, while type 3 came in before 1 ( chronological order) This mean that machine configuration for type 3 will be removed and 2 will enter the system with a set up change. So the fifth value of the new vector X should be 1. (1= set up is needed).
6) the seventh entity will be 1. 1 is present in the previous two different entities. So the seventh value of the new vector X should be 0. (0=no set up)
7) NOW entity 3 is entering the system. The previous two entity were 2 and then 1. it means that 2 will be removed to free a space for 3. So the eighth value of the new vector X should be 1. (1= set up is needed)
May someone help me with the code? The final should be to obtain the Final Vector X with value 0 or 1, that states if the set up is needed or not.
  댓글 수: 3
luca
luca 2019년 7월 8일
Hi Walter, may you give me some more detail about your idea?
Walter Roberson
Walter Roberson 2019년 7월 8일
https://www.mathworks.com/products/simscape.html includes a state transition system

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by