help with fminsearch output value
5 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I'm trying to understand the use of fminsearch, to find the argument that minimizes the difference between two data sets (one experimental and several theoretical ones). As described in some articles, the mathematical expression is : min(mean(Xi-X_av).^2), were Xi = Experimental/theory(n) and X_av is the average off all the Xi.
As a test, I created a simple function as the experimental (EXP) and theory (Xi).
a = [1:10]';
EXP = exp(a*0.2);
coeff = [0.1,0.13,0.15,0.17,0.2];
theo = exp(a.*coeff)
Xi = EXP./(theo);
It can be seen that (a) are the row numbers. There are 5 arrays corresponding to the different functions. Xi(:,5) should be the answer to fminsearch.
Continuing with the function to minimize the squared difference,
X_av = mean(Xi,2);
fun = @(Xi)(mean(Xi-X_av).^2);
[x,val] = fminsearch(fun,1);
and turns out that val = 1.637758538081846e-09, instead of 5. X = 1.363769531250001.
I have been reading the reference page for fminsearch, but I am bit stacked.
In practice, I will have an array of values as a look up table, that need to be compared to the experimental data. Rows are not important (will be the frequency). What I need is the column number that gives the lowest difference. The data is non-linear by the way, typically as 10log10.
Any suggestions please?
- To make fminsearch as a function of columns, is @(Xi) correct?. - As in my case, how to set up initial x0 values in [x,val]?. Using value from 1 to 8, val output does not change. - X shouldn't be 0 since it's the best solution?
Thanks
0 件のコメント
採用された回答
John D'Errico
2017 年 7 月 25 日
A column number is a discrete thing. fminsearch cannot solve that.
Regardless, you don't want to use an optimization (minimization) tool, but more like a root finder, if you are searching for a column of an array. Again, that is not fminsearch.
Just use a loop. Test each column. Take the best. You don't have many columns, so WTP?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!