Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Global Optimization not returning correct values

1 visualización (últimos 30 días)
Jacob Ward
Jacob Ward el 9 de Jun. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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.

Respuestas (1)

Titus Edelhofer
Titus Edelhofer el 9 de Jun. de 2015
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

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by