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 visualizzazione (ultimi 30 giorni)
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?

Risposte (1)

Lokesh
Lokesh il 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':

Categorie

Scopri di più su Function Creation in Help Center e File Exchange

Tag

Prodotti


Release

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by