필터 지우기
필터 지우기

Simulink: setting different random number generator seeds even when using past SimState

조회 수: 19 (최근 30일)
Hi,
I have a problem in that I need to run multiple simulations using a previously saved SimState with different randomness seeds. I haven't managed to get this to work yet.
I have tried using
set_param('mod/Random Number', 'Seed', '3324')
and this works if I don't use a previously saved SimState, but as soon as I try this with a SimState all simulations still end up with the same random numbers (I guess that the newly set seed is being ignored and instead the seed saved in the SimState is being used, although I have tried looking at the SimState data structure and I couldn't really figure out if it even contains the past seed and if it does how I am supposed to go about changing it).
What would be my best approach here?
Note: I have tried to manually implement a random generator and getting the random numbers using a root level input, but the problem here is that with a variable step solver the interpolation doesn't work!

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 2월 14일
AFAIK, only tunable parameters can be changed in a simulation restored from a previously stored SimState. From what I can see, the "Seed" parameter of the Random Number block is non-tunable (you can test this by running a model containing the block for StopTime=Inf, then double-click on the block. Only textboxes corresponding to tunable-parameters are enabled during simulation).
  댓글 수: 2
Oliver
Oliver 2012년 2월 14일
Thanks for your answer. That is what I feared. I have been able to solve the problem with a custom Random Number generator, but I think, that you should consider changing this in future generations of Matlab. Not being able to change randomness seeds means that the probabilistic nature of models is no longer reflect after using SimStates.
Thanks anyhow!
Kaustubha Govind
Kaustubha Govind 2012년 2월 14일
Oliver: Please consider submitting this as an enhancement request via MathWorks Tech Support.

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

추가 답변 (1개)

James
James 2013년 3월 10일
For those of you still looking for a solution, someone posted this on file exchange, it might help you out.

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by