Note that there are some explanatory texts on larger screens.

plurals
  1. POconditional generation of random numbers using matlab
    text
    copied!<p>I have a function that generates normal random number matrix having normal distribution using normrnd. </p> <pre><code> values(vvvv)= normrnd(0,0.2); </code></pre> <p>The output is from round1 is: ans =</p> <pre><code>0.0210 0.1445 0.5171 -0.1334 0.0375 -0.0165 Inf -0.3866 -0.0878 -0.3589 </code></pre> <p>The output from round 2 is: ans =</p> <pre><code>0.0667 0.0783 0.0903 -0.0261 0.0367 -0.0952 0.1724 -0.2723 Inf Inf </code></pre> <p>The output from round 3 is: ans =</p> <pre><code>0.4047 -0.4517 0.4459 0.0675 0.2000 -0.3328 -0.1180 -0.0556 0.0845 Inf </code></pre> <p>the function will be repeated 20 times.</p> <p>It is obvious that the function is completely random. What I seek is to add a condition.</p> <p>What I need is: if any entry has a value between 0.2 and 0.3. that value will be fixed in the next rounds. Only the remaining entries will be subjected to change using the function rand.</p> <p>I have found the rng(sd) which seeds the random number generator using the nonnegative integer sd so that rand, randi, and randn produce a predictable sequence of numbers.</p> <p><a href="https://stackoverflow.com/questions/4682080/how-to-set-custom-seed-for-pseudo-random-number-generator">How to set custom seed for pseudo-random number generator</a></p> <p>but how to make several entries of the matrix only effected!!</p> <p>Another problem: seems that rng is not available for matlab r2009 How to get something similar without entering in the complication of probability &amp; statistics</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload