필터 지우기
필터 지우기

rand returns me the same numbers on Simulink?

조회 수: 5 (최근 30일)
Teng Da Wen
Teng Da Wen 2020년 6월 23일
댓글: Teng Da Wen 2020년 6월 23일
Hello,
I'm making a simulation of how much time is required for an Item to get through some Workstation, and I wanted to give some kind of randomness to worktime, I tried by using a Matlab action service time source, and having a minimum Worktime on which is added the max delay the station can have multiplied for a rand(1) function (as shown below).
However running the simulation multiple times I noticed the value of service time that is returned is always the same, what am I doing wrong? how should I solve it?
Thanks in advance

채택된 답변

Reeshabh Kumar Ranjan
Reeshabh Kumar Ranjan 2020년 6월 23일
Hey Teng,
See if it solves your problem.
  댓글 수: 1
Teng Da Wen
Teng Da Wen 2020년 6월 23일
Ye it was it, I solved this by adding this line of code, Actually I had already tried with rng('Shuffle') but it didn't work, then I found out on simulink I need to declare the function as an exstrinsic one, thanks.
coder.extrinsic('rng');
rng('shuffle')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by