Matlab error: Error using simulannealbnd Too many input arguments. Error in mainsa (line 12) [x, fval, exitflag, output] = simulannealbnd(abc, x0, [], [], lb, ub, options);

2 次查看(过去 30 天)
clc;
clear all;
close all;
abc = @function1;
x0 = 0;
lb = 0;
ub = 0.7;
options = saoptimset('OutputFcns',@outputfunction)
[x, fval, exitflag, output] = simulannealbnd(abc, x0, [], [], lb, ub, options);
While running the above code it shows some error:
Error using simulannealbnd
Too many input arguments.
Error in mainsa (line 12)
[x, fval, exitflag, output] = simulannealbnd(abc, x0, [], [], lb, ub, options);
How can I solve this?

回答(1 个)

Lokesh
Lokesh 2024-4-25
Hi ASWATHI,
The correct syntax for the 'simulannealbnd' function is as follows: "simulannealbnd(fun,x0,lb,ub,options)". Based on your code, it seems that you are passing an extra argument in your function call. To resolve this issue, you should modify your function call from:
%Existing function call
[x, fval, exitflag, output] = simulannealbnd(abc, x0, [], [], lb, ub, options);
%Modified function call
[x, fval, exitflag, output] = simulannealbnd(abc, x0, lb, ub, options);
This adjustment removes the extra argument, aligning the call with the expected syntax and should solve the issue.
Refer to the following MATLAB documentation for more information on 'simulannealbnd':

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

产品


版本

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by