Error in optimization process

조회 수: 5 (최근 30일)
Fred
Fred 2013년 10월 4일
편집: Matt J 2013년 10월 4일
I am trying to fit a gumbel distribution on a series of data. So I want to minimize the negative of maximum likelihood by optimizing two variables var(1) and var(2). This is my code:
X=xlsread('file.xlsx');
options = optimset('MaxFunEvals',1000,'FinDiffType','central');
options=optimset(options,'Display','iter','MaxIter',1000,'TolCon',1e-6);
lb=0;
ub=Inf;
var=zeros(2,1);
x = fmincon(@(var)Gumbel(var,X),1,1,[],[],[],[],lb,ub,[],options);
and my Gumbel function is:
function f=Gumbel(var, X)
f=-sum(log((1./var(1)).*exp(-(X-var(2))./var(1)-exp(-(X-var(2))./var(1)))))
Can someone help me why I am getting errors?! Thanks
  댓글 수: 2
Shashank Prasanna
Shashank Prasanna 2013년 10월 4일
What are you errors? Can you post it here?
Fred
Fred 2013년 10월 4일
편집: Fred 2013년 10월 4일
Error using fmincon (line 294)
Row dimension of A is inconsistent with length of b.
Error in LL (line 10)
x = fmincon(@(var)Gumbel(var,X),1,1,[],[],[],[],lb,ub,[],options);

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

채택된 답변

Matt J
Matt J 2013년 10월 4일
편집: Matt J 2013년 10월 4일
Your input arguments are out of sequence. Also, you have too many of them. fmincon can only accept 10 inputs and you've passed in 11.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by