About random number generators

조회 수: 1 (최근 30일)
ahmed abrous
ahmed abrous 2014년 2월 22일
답변: ahmed abrous 2014년 2월 25일
Hi everyboby
I want to create a program on simulink which use a random number box but I have seen that its output is repeated at each step of the simulation. So how can I change the seed of this program to get the good result.
I use actually matlab 2010a, and I tried rng bgut not working.
Thank you.

채택된 답변

Lucas García
Lucas García 2014년 2월 22일
As you have found out, using rng is the way to go with the current MATLAB version.
Although currently discouraged, you can use the former synthax for changing the seed with older MATLAB versions: http://www.mathworks.es/es/help/matlab/math/updating-your-random-number-generator-syntax.html
rand('seed', sd)
  댓글 수: 1
ahmed abrous
ahmed abrous 2014년 2월 22일
Yes, exactly, but I don't have Matlab 2013 on my computeur. Also I want to use uniform random number block on simulink, and when I read the help it says "Output is repeatable for a given seed". So the goal is to change this seed on simulink at each sample time of the simulation.

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

추가 답변 (2개)

Dishant Arora
Dishant Arora 2014년 2월 22일
doc se_randomizeseeds
  댓글 수: 3
Dishant Arora
Dishant Arora 2014년 2월 22일
You need to stop and change the seed before every simulation

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


ahmed abrous
ahmed abrous 2014년 2월 25일
It's okay for me with the Embedded Matlab Function and the seed change at every sample time. Thank you.

카테고리

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