normcdf() not working
Afficher commentaires plus anciens
Initially I was writing a program to evaluate the Black-Scholes formula from given values but when I attempted to include normcdf function I got an error. Not sure what is causing it.
>
> normcdf(.5)
Undefined function 'normcdf' for input arguments of type 'double'.
>> b = normcdf(.7)
Undefined function 'normcdf' for input arguments of type 'double'.
4 commentaires
Star Strider
le 4 Sep 2015
It’s in the Statistics Toolbox. Do you have it?
the cyclist
le 4 Sep 2015
What do you get if you type
which -all normcdf
dxander
le 5 Sep 2015
Réponses (1)
Star Strider
le 5 Sep 2015
Either you need to get a license for it (contact the person responsible for such things in your orgainsation), or if you just want a quick fix (no confidence bounds), this works:
nrmcdf = @(x,m,s) integral(@(t)exp(-(t-m).^2./(2*s.^2)), -Inf, x )./(s*sqrt(2*pi)); % Variable=‘x’, Mean=‘m’, StdDev=‘s’
Q1 = nrmcdf(-1, 0, 1);
Q2 = nrmcdf(+1, 0, 1);
Qd = Q2-Q1;
The ‘Q’ values are for demonstration only, and show the part of the curve between [+1 -1] standard deviations, with mean=0 and std=1.
Catégories
En savoir plus sur Downloads dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!