optimizing 2 parameters with fmincon
조회 수: 2 (최근 30일)
이전 댓글 표시
I was optimizing a function named ML with fmincon to find the parameter "theta",
twostage = fmincon(@(theta)ML(theta,param,x,y),theta,[],[],[],[],lb,ub,[],options);
now I want to optimize another function ML2 for two parameters "theta1" and "theta2", can fmincon optimize a function for 2 parameters? how should I write the function?
Thanks
댓글 수: 0
채택된 답변
Matt J
2012년 11월 30일
편집: Matt J
2012년 11월 30일
Make theta a 2x1 vector instead and rewrite ML accordingly, to interpret theta as a 2x1 input vector. Also make ub and lb 2x1.
댓글 수: 2
Matt J
2012년 11월 30일
Yes, although once theta has been passed to ML, there's no reason you couldn't unpack as follows within the ML code:
theta1=theta(1);
theta2=theta(2);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!