Clear Filters
Clear Filters

minimizing a complex cost function using fmincon and lsqnonlin

4 views (last 30 days)
Dear all , I intend to minimize the above cost function (CF) using non-linear LS algorithm (fmincon and lsqnonlin) in matlab. the main purpose is estimating SM* and L-VOD* using SM*ini (intital value for SM*) and L-VOD*ini (intital value for L-VOD*). in other word, with the second and third terms we try to minimize the estimate value for unknown parameters (SM* and L-VOD*) and their associating intital values at each iteration. I just wondering how can I write and define this cost function at Matlab to understand the second the third term correctly. at the moment, I get wrong answers and only I have one iteration. my code cannot understand the it has to compare the estimated SM* and L-VOD* and their associating intial values. it substitute intital value directly and get zeros for the second and third part.
Any suggestion would be highly appreciated.
Thanks in advance for your help!
Regards,
Mina
  4 Comments
Sam Chak
Sam Chak on 27 Feb 2024
@Mina Mino: I get wrong answers...
What are the expected 'correct values'?
This isn't a static optimization problem, right? Since there are initial values, I assume that the cost function changes over the off-screen parameter, time t. Is the cost function diverging, converging towards a steady value, or oscillating within certain limits over time?
Better reveal the MATLAB code for clarity...
Mina Mino
Mina Mino on 28 Feb 2024
Edited: Sam Chak on 28 Feb 2024
Thanks for your reply. indeed the parameters that I intend to determine by minimizing the cost function are and . The main part that should be minimize is the first term of the attached equation. simulated () is calculated using initial values ( (intital value for SM*) and (intital value for )) for unknown parameters.
However, minimizing this term is only ideal due to the presence of errors such as auxiliary data, that is why we need to consider the error between the inversion parameters ( and ) and the a priori knowledge ( (intital value for ) and (intital value for )) for constraint retrieval.the second and third term in the attached equation are added due to this issue.
I am just woundering it is correct to introduce the cost function in the following form or I have to do in other way.
Thanks in advance for any suggestion.
function rmse = cost_function3(params, inti_SM, int_VOD, observed_reflectivity, C, T, H_r, theta)
% W = params(1);
% tau_nad = params(2);
modeled_reflectivity = reflectivity_model(params,C, T, H_r, theta);
% rmse = ((sum((modeled_reflectivity - observed_reflectivity).^2))/(std(observed_reflectivity).^2))+ (W-inti_SM).^2/0.04 + (tau_nad-int_VOD).^2/0.04;
rmse1 = sum((modeled_reflectivity - observed_reflectivity).^2)/(std(observed_reflectivity).^2);
term1 = (params(1) - inti_SM).^2 / 0.04;
term2 = (params(2) - int_VOD).^2 / 0.04;
rmse = rmse1 + term1 + term2;
end

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!