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)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
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':
0 Kommentare
Siehe auch
Kategorien
Mehr zu Function Creation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!