How to solve normcdf function error
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have the following error log:
Error using erf
Input must be real and full.
Error in normcdf (line 47)
p(k) = 0.5 * (1 + erf((x(k) - mu(k)) ./ (sigma(k) * sqrt(2))))_ _
the code used is:
function p = normcdf(x,mu,sigma)
if nargin < 3,
sigma = 1;
end
if nargin < 2;
mu = 0;
end
[errorcode x mu sigma] = distchck(3,x,mu,sigma);
if errorcode > 0
error('The arguments must be the same size or be scalars.');
end
p = zeros(size(x));
k1 = find(sigma <= 0);
if any(k1)
p(k1) = NaN * ones(size(k1));
end
k = find(sigma > 0);
if any(k)
p(k) = 0.5 * (1 + erf((x(k) - mu(k)) ./ (sigma(k) * sqrt(2))));
end
k2 = find(p > 1);
if any(k2)
p(k2) = ones(size(k2));
end
Please could you help me to solve this issue? thanks a lot in advance Irene
1 commentaire
Geoff Hayes
le 14 Jan 2015
Modifié(e) : Geoff Hayes
le 14 Jan 2015
Irene - how are you calling the normcdf function? What inputs are you using? I noticed that you tagged your question with symbolicnumber. Are you passing a symbol into this function?
Réponses (0)
Voir également
Catégories
En savoir plus sur Detection dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!