Error 'Assignment has more non-singleton rhs dimensions than non-singleton subscripts'

Hi, I'm getting following errors while using mle with a custom pdf:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in fminsearch (line 200) fv(:,1) = funfcn(x,varargin{:});
Error in mlecustom (line 184) fminsearch(llf,start,opts,uncensData,censData,uncensFreq,censFreq,fun1Args,fun2Args,checkFunVals,lb,ub);
Error in mle (line 237) phat = mlecustom(data,varargin{:});
Error in mleexample (line 58) mle(DT,'pdf',pdf,'start',start);
MY SCRIPT:
pdf=@(x,a,b)h(x,a,b);
mi=0.3;
sigma=0.2;
start=[mi,sigma];
mle(DT,'pdf',pdf,'start',start);
function s=h(x,a,b)
k=a^2/b;
phi=b/a;
i=0;
s=ones(1,length(x));
while i<=29
s=s.*(x.^(k-1).*(exp(1).^(-x./phi))/(gamma(k)*phi^k));
i=i+1;
end
end
Can somebody help? Thank you very much.

Answers (0)

Asked:

on 23 Dec 2016

Edited:

on 23 Dec 2016

Community Treasure Hunt

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

Start Hunting!