Plot[PDF[NormalDistribution[mu, sigma], x], {x, -4*sigma, 4*sigma}],
    {mu, -10, 10}, {sigma, 0, 10}

I got the following error:

enter image description here


For the code to work without error messages, signa needs an initial value, for instance:

Manipulate[Plot[PDF[NormalDistribution[mu, sigma], x], {x, -4*sigma, 
   4*sigma}], {mu, -10, 10}, {{sigma, .5}, 0, 10}]

Alternatively, just tolerate the initial error messages, and move the sigma slider to obtain the desired results.

| improve this answer | |
  • $\begingroup$ Thanks. I just realized that it's stupid mistake. Sigma should be >0. $\endgroup$ – Chen Stats Yu May 21 '15 at 17:30
  • 1
    $\begingroup$ Or, if you don't care too much about the error (like if this is going to some other user, who might try any input, including illegal values), using Quiet[ ] around the body of Manipulate might be a safer option. You can also set specific errors/wranings to eliminate. $\endgroup$ – Bichoy May 22 '15 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.