필터 지우기
필터 지우기

Why my Nonlinear function cannot be solved??

조회 수: 2 (최근 30일)
연승 김
연승 김 2021년 9월 29일
댓글: 연승 김 2021년 9월 29일
I'm MATLAB beginner. so please help me~^^*
fun_y =
function_handle with value:
@(y1,y2)y1.*8.0e+1+y2.*7.0e+1-log(y1)-log(y2)
y1 = optimvar('y1');
y2 = optimvar('y2');
prob.Objective = fcn2optimexpr(fun_y, y1, y2);
y0.y1 = 1;
y0.y2 = 1;
[sol,fval] = solve(prob,y0);
However, the error masssage is "Check for missing argument or incorrect argument data type in call to function 'solve'.".
I don't know how to correct... UU
Help me please...!

채택된 답변

Matt J
Matt J 2021년 9월 29일
편집: Matt J 2021년 9월 29일
fun_y=@(y1,y2)y1.*8.0e+1+y2.*7.0e+1-log(y1)-log(y2);
y1 = optimvar('y1');
y2 = optimvar('y2');
prob = optimproblem('Objective',fcn2optimexpr(fun_y, y1, y2));
y0.y1 = 1;
y0.y2 = 1;
[sol,fval] = solve(prob,y0)
Solving problem using fminunc. Local minimum possible. fminunc stopped because the size of the current step is less than the value of the step size tolerance.
sol = struct with fields:
y1: 0.0125 y2: 0.0143
fval = 10.6305
  댓글 수: 1
연승 김
연승 김 2021년 9월 29일
Wow. you're genius!!!!!! Wow.. amazing...
I have to study hard!!

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

추가 답변 (0개)

카테고리

Help CenterFile 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!

Translated by