Optimizing a function consisting of other variables
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I have a function as this:
function l=L2(u1, u2, w, x) l = -sum(log(((log(u1).*log(u2)).^(-1+x)).*((w.^((2-2*x)/x))-(1-x.*(w.^(1-2*x)/2)))./(u1.*u2.*exp(w.^(1/x))))); end
which u1, u2, w are 40*1 vectors, and I want to optimize this for min of x with optimtool but his gives me the error of
Error in the following problem input(s): objective: Not enough input arguments.
Can anybody help me?
댓글 수: 1
Matt J
2012년 10월 14일
Show more code, in particular, the solver that you're using and the code you use to call it.
Also, use markup to make the code you post more readable, including the code in your Question.
채택된 답변
Alan Weiss
2012년 10월 15일
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 2
Matt Tearle
2012년 10월 15일
u1 = ...
u2 = ...
w = ...
objfun = @(x) L2(u1,u2,w,x) % define a function of x with u1, u2, w fixed
Now use objfun as your objective function.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!