필터 지우기
필터 지우기

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