Too Many Input Arguments

3 visualizaciones (últimos 30 días)
Madeline Alzamora
Madeline Alzamora el 21 de Nov. de 2021
Comentada: Star Strider el 21 de Nov. de 2021
Hello! I've checked my code multiple times, and I keep getting a "too many inputs" error. Would anyone be able to help?
function b = kinetics123(v)
k1 = v(1);
k2 = v(2);
k3 = v(3);
k4 = v(4);
k5 = v(5);
b =(k1*k3*102*sqrt(k2*100)*0.0008*(1+k1*102+sqrt(k2*100)+(k3/k4)*k1*102*(0.609/k5))^2 - (6.1*10^-5));
end
v = [0.1, 0.1, 0.1, 0.1, 0.1];
options = optimset('MaxFunEvals',1000);
q = fminsearchbnd(@kinetics123, v, [], [], options)
Error using kinetics123
Too many input arguments.
Error in fminsearchbnd>@(x,varargin)fun(xtransform(x),varargin{:}) (line 233)
intrafun = @(x, varargin) fun(xtransform(x), varargin{:});
Error in fminsearch (line 201)
fv(:,1) = funfcn(x,varargin{:})
  1 comentario
Madeline Alzamora
Madeline Alzamora el 21 de Nov. de 2021
Also when I go through debugging, the function kinetics123 reads all of the input in correctly.

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 21 de Nov. de 2021
This works (with and without the norm call) —
v = [0.1, 0.1, 0.1, 0.1, 0.1];
[B,fv] = fminsearch(@kinetics123, v) % Without 'norm'
Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -21938913608024237095924990053658057124452464574261387201643260652167428249316775121043664379710237162164047785759422273482999418904150474824722563045423035223507880578537363894487937679396863294586303477699253665349954558661450752149220753408.000000
B = 1×5
1.0e+53 * -1.3634 0.3493 0.0546 0.4180 0.2841
fv = -2.1939e+241
[B,fv] = fminsearch(@(b)norm(kinetics123(b)), v) % With 'norm'
B = 1×5
-0.0111 0.0804 0.0890 0.1668 0.1356
fv = 6.1002e-05
function b = kinetics123(v)
k1 = v(1);
k2 = v(2);
k3 = v(3);
k4 = v(4);
k5 = v(5);
b =(k1*k3*102*sqrt(k2*100)*0.0008*(1+k1*102+sqrt(k2*100)+(k3/k4)*k1*102*(0.609/k5))^2 - (6.1*10^-5));
end
Adding the norm call (finds the minimum greater than sero) produces different parameter estimates. The code runs without error either way here.
I have no idea what the code is su0pposed to do otherwise.
.
  10 comentarios
Madeline Alzamora
Madeline Alzamora el 21 de Nov. de 2021
!!! I fixed a factor in my equation and played around a little bit in the structure and it's working! The esttotalrate starts off at the appropriate value, and my B values are stabilizing.
I can't thank you enough for helping me! I've been stuck on this for three days and it was driving me insane.
Star Strider
Star Strider el 21 de Nov. de 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by