フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Global Optimization not returning correct values

1 回表示 (過去 30 日間)
Jacob Ward
Jacob Ward 2015 年 6 月 9 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a function d = f(a1,a2,a3) which I am trying to fit to data by minimizing the error using the optimization options available in MATLAB. Basically, given a set of data, I am trying to back out the constants a1, a2, and a3 that caused the data to behave that way. To test this, I ran the function f with the known set of variables to create an initial data set then ran an optimization routine to back out the constants. However, the values of the constants that were produced were not the ones I started with. The minimum error between the two cases was extremely small (e-10) but I want the program to reproduce the constants I started with. I have tried several different built in routines ranging from ga to GlobalSearch but I haven't had any luck. Is there any way I can do this?
for example
A = [0.1 0 -0.01];
d1 = f(A);
F = @(a) f(a)l
FObjective = @(a)sum((F(a)-d1).^2);
a0 = [0 0 0];
options('fminunc','Algorithm','quasi-newton');
[A, fval] = fminunc(FObjective,a0,options);
Again, I've tried many functions other than fminunc including fmincon but I cannot the get the program to produce the answer I want.

回答 (1 件)

Titus Edelhofer
Titus Edelhofer 2015 年 6 月 9 日
Hi Jacob,
you mean similar to this?
x = 1:5;
y = polyval([1 0.5 0.25], x);
polyfit(x, y, 2)
ans =
1.0000 0.5000 0.2500
polyfit(x, y, 2)-[1 0.5 0.25]
ans =
1.0e-14 *
0.1332 -0.6495 0.7272
If you worry about this kind of deviation, then you will be unlucky, because no optimizer will reproduce the constants exactly without numerical error.
You might get closer by using optimset and reduce the tolerances, but I'm not sure why you want to exactly reproduce. It's better to see if the tolerance is acceptable ...
Titus

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by