Simulink: setting different random number generator seeds even when using past SimState
6 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Kaustubha Govind
on 14 Feb 2012
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 Comments
Kaustubha Govind
on 14 Feb 2012
Oliver: Please consider submitting this as an enhancement request via MathWorks Tech Support.
More Answers (1)
James
on 10 Mar 2013
For those of you still looking for a solution, someone posted this on file exchange, it might help you out.
0 Comments
See Also
Categories
Find more on Sources in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!