fmincon returning to initial values not true

3 ビュー (過去 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 Center および File ExchangeSystems 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