How to solve normcdf function error

3 visualizzazioni (ultimi 30 giorni)
Irene
Irene il 13 Gen 2015
Modificato: Geoff Hayes il 14 Gen 2015
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 Commento
Geoff Hayes
Geoff Hayes il 14 Gen 2015
Modificato: Geoff Hayes il 14 Gen 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?

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by