How to solve normcdf function error
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Geoff Hayes
am 14 Jan. 2015
Bearbeitet: Geoff Hayes
am 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?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Detection finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!