help with fminsearch output value
이전 댓글 표시
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개)
카테고리
도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!