Simulink: setting different random number generator seeds even when using past SimState
6 次查看(过去 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!
0 个评论
采纳的回答
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 个评论
Kaustubha Govind
2012-2-14
Oliver: Please consider submitting this as an enhancement request via MathWorks Tech Support.
更多回答(1 个)
James
2013-3-10
For those of you still looking for a solution, someone posted this on file exchange, it might help you out.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!