How to use fminsearch to minimize sum of the squares and find the constant values?

조회 수: 3 (최근 30일)
R7 DR
R7 DR 2015년 3월 12일
편집: R7 DR 2015년 3월 13일
I have two data sets, D1 and D2. where D1 and D2 has the experimental and Calculated values. How to find the constant values by minimizing the sum of the squares(sum(D1-D2)^2 ==0).
Sum (s)= (D1-D2)^2 ==0
D1=[......] %experiemntal
D2=[......] % calculated
X =[......] % dimensions are same as D1&D2
Y =[......] % dimensions are same as D1&D2
D2= a*exp(b/X)*Y %%D2 is a function of A,B,X,Y
Sum (s)= (D1-D2)^2 ==0 %% the difference in the sum of the squres between D1 and D2 should be close to zero.
How to find the values of a and b by minimizing the sum of the squares between D1 and D2?
Thanks
  댓글 수: 3
dpb
dpb 2015년 3월 12일
편집: dpb 2015년 3월 12일
There's an example under doc fminsearch of the subject "Curve Fitting via Optimization" one of which is, in fact, an exponential.
OTOH, if you happen to have the Optimization Toolbox, lsqnonlin saves writing the explicit residual.
R7 DR
R7 DR 2015년 3월 12일
Hi
That answer is good and working fine.
But, I read in the internet that we can use 'fminsearch' also to solve these type of problems. My function is very senstive to initial guess, so I want try by using 'fminsearch' function. Actually I want to check which one is giving the better results for my function.
Thanks

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by