fmincon returning to initial values not true
3 views (last 30 days)
Show older comments
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 Comment
Answers (1)
Steven Lord
on 9 May 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])
If your function looks like it's not decreasing, why should fmincon choose to return a different location than the place where it started?
0 Comments
See Also
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!