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

5 vues (au cours des 30 derniers jours)
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?

Réponses (1)

Lokesh
Lokesh le 25 Avr 2024 à 11: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':

Tags

Produits


Version

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by