Fixing fzero in standard normal distribution
Show older comments
I am trying to solve a variable n used in this equation for normal distribution
Z = (X - mean) / std
mean = 500*n
std = sqrt(500*n*(1-n))
X = 440
Z = -2.33
This is the code i am trying to use to solve it
N = @(n) (((440 - 500*n)/(sqrt(500*n*(1-n))))+2.33)
fzero(N,0)
How do you suggest I change it so I get a real value from n?
Accepted Answer
More Answers (1)
Note that your problem has a closed-form solution, i.e. fzero is not necessary:
X = 440; Z = -2.33;
syms n; assume(X-500*n<=0)
n=double( solve( (X - 500*n)^2 == 500*n*(1-n)*Z^2 ) )
Categories
Find more on Univariate Discrete Distributions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!