Error in the use of fminunc function

16 ビュー (過去 30 日間)
Silvia
Silvia 2023 年 9 月 25 日
回答済み: Matt J 2023 年 9 月 25 日
Hello everyone,
in the following there is my matlab code:
>> fun = @(x)3*x(1)^2 + 2*x(1)*x(2) + x(2)^2 - 4*x(1) + 5*x(2);
>> x0 = [1,1];
>> [x,fval] = fminunc(fun,x0);
and this is the error that I have:
Unable to load a message catalog 'optim:fminusub'. Please check the file location and format.
Error in createExitMsg (line 32)
basicMsg = getString(message(basicMsgArgs{:}));
Error in fminusub (line 322)
output.message = createExitMsg(msgData{:});
Error in fminunc (line 496)
[x,FVAL,GRAD,HESSIAN,EXITFLAG,OUTPUT] = fminusub(funfcn,x, ...
Someone can help me to solve this problem?
Thak you a lot

回答 (2 件)

Torsten
Torsten 2023 年 9 月 25 日
編集済み: Torsten 2023 年 9 月 25 日
Put your three lines of code in a script file, call it "test.m", load it in the MATLAB editor and execute the script by the green RUN arrow. Does it work now ?
Steven Lord's answer given here might help if this is not the case:
  4 件のコメント
Silvia
Silvia 2023 年 9 月 25 日
license('checkout','optimization_toolbox')
1
which -all fminunc
C:\Program Files\MATLAB\R2023a\toolbox\shared\optimlib\fminunc.m
thaks for your help
Torsten
Torsten 2023 年 9 月 25 日
Did you make any changes to your MATLAB installation ? Modified or deleted files ? Mixed files from different releases ?
If not, you should contact Technical Support:

サインインしてコメントする。


Matt J
Matt J 2023 年 9 月 25 日
I would try a clean re-install of Matlab (i.e., deleting all installation folders that may have been created).

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by