フィルターのクリア

Fit multivariable objective function using fminsearch

6 ビュー (過去 30 日間)
JayD
JayD 2015 年 10 月 15 日
コメント済み: Star Strider 2015 年 10 月 15 日
I have been trying to fit bi-exponential function with 4 variables using fminsearch. I am having difficulty to formulate it in correct way. can you please help me to work it out. (The code is successfully run for lsqnonlin but results are very unreasonable)
b=[50 400 800]; ydata=[850 400 90];
f=@(x,b) x(1)*(x(2)*exp(-x(3)*b)+(1-x(2))*exp(-x(4)*b));
x0=[950,0.3,0.002,0.01];
options = optimset('MaxFunEvals',1e9,'MaxIter',1e9,'TolFun', 1e-8, 'TolX', 1e-8);
X=fminsearch(f,x0,options);

採用された回答

Star Strider
Star Strider 2015 年 10 月 15 日
You cannot do what you want. You have three data pairs, so you can fit a maximum of three parameters, not the four you want to fit. (Consider fitting a line that requires two parameters — slope and intercept — through a point — one data pair. You can fit an infinite number of lines, all of which are ‘correct’.) You do not know what your data are except where you measure them, so interpolating to create more ‘data’ is not an acceptable solution. So regardless of the solver you use, you are not going to get reliable parameter estimates.
You are also missing a cost function in your code. You need to minimise this instead of ‘f’:
SSECF = @(x) sum((f(x,b)-ydata).^2); % Sum-Squared-Error Cost Function
X=fminsearch(SSECF,x0,options);
You still will not get reliable parameter estimates, but at least the code will be correct!
  2 件のコメント
JayD
JayD 2015 年 10 月 15 日
Thank so much for the response. First of all I apologize putting up my original objective function here. Since I cannot change the data set I have, I made a different approach to merge 2 variable into one and solve it using lsqnonlin and then solve for merged variable in other means.(still lsqnonlin wasn't reliable). Now I can see what I missed for fminsearch was the cost function. This is helpful. Thank you again.
Star Strider
Star Strider 2015 年 10 月 15 日
My pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOptimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by