Fixing fzero in standard normal distribution
5 views (last 30 days)
Show older comments
MADISON RAGONE
on 24 Feb 2023
Commented: Star Strider
on 24 Feb 2023
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?
0 Comments
Accepted Answer
Star Strider
on 24 Feb 2023
Change the initial parameter estimate to something other than 0. The fzero function is a root-finding algorithm, so it looks for zero-crossings.
Perhaps something like this —
N = @(n) (((440 - 500*n)/(sqrt(500*n*(1-n))))+2.33)
nv = fzero(N,rand)
.
2 Comments
Star Strider
on 24 Feb 2023
As always, my pleasure!
It is just that. However it is a random number between 0 and 1, so limited in its amplitude.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!