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

1 Ansicht (letzte 30 Tage)
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?

Antworten (1)

Lokesh
Lokesh am 25 Apr. 2024
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':

Kategorien

Mehr zu Function Creation finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by