How to solve normcdf function error

조회 수: 4 (최근 30일)
Irene
Irene 2015년 1월 13일
편집: Geoff Hayes 2015년 1월 14일
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
Geoff Hayes
Geoff Hayes 2015년 1월 14일
편집: Geoff Hayes 2015년 1월 14일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Detection에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by