fmincon returning to initial values not true

조회 수: 2 (최근 30일)
Elaine
Elaine 2025년 5월 9일
편집: Matt J 2025년 5월 9일
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
Matt J
Matt J 2025년 5월 9일
편집: Matt J 2025년 5월 9일
On every iteration fmincon reduces the cost
Are you saying it strictly reduces it? We would need to see a demonstration.

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2025년 5월 9일
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?

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by