fmincon returning to initial values not true

3 visualizaciones (últimos 30 días)
Elaine
Elaine el 9 de Mayo de 2025
Editada: Matt J el 9 de Mayo de 2025
I am working with the DDM and doing some paramter recovery. I am calculating a possible range of paramters (v,a,ter). For every possible combination, params(i,:), I am 1) simulating data with these parameters, this I will call the 'true' data. 2) I am comparing this 'true' data to data simulated with best fitting parameters using fmincon and a personal cost function,
cost_fun = @(x) newcostfunc(x, RT, acc);.
[est_params, fval,~,output] = fmincon(cost_fun, x0, [], [], [], [], lb, ub, [], opts);
My issue is that fmincon consistently outputs 'est_params' with values identical to the start values, x0, rather than the true values. x0 is defined as a random set of values between the bounds, so that it is not too close to the true parameter values.
On every iteration fmincon reduces the cost but the values output as being the best always remain the same. My cost function calculates chi-square from the normalised proportions of values within the true and simulated data quantiles.
I have played around with the options for fmincon but can't find a solution to my problem. I hope my problem is clear.
  1 comentario
Matt J
Matt J el 9 de Mayo de 2025
Editada: Matt J el 9 de Mayo de 2025
On every iteration fmincon reduces the cost
Are you saying it strictly reduces it? We would need to see a demonstration.

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 9 de Mayo de 2025
It's likely going to be difficult to offer any concrete guidance without seeing or knowing more about newcostfunc. Does it call round on the input arguments at all?
x = -5:0.01:5;
f = @(x) round(x).^2;
y = f(x);
plot(x, y)
If your initial point was at x = 0 and fmincon tried to evaluate the function at 0.1 and -0.1 (to determine in which direction your function decreases) what values would it get?
searchpoints = f([-0.1 0 0.1])
searchpoints = 1×3
0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
If your function looks like it's not decreasing, why should fmincon choose to return a different location than the place where it started?

Categorías

Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by