Question About Correction Factor

5 views (last 30 days)
Ignatius Tommy Pratama
Ignatius Tommy Pratama on 17 Dec 2017
Commented: Star Strider on 18 Dec 2017
Hi.. Currently, I am doing a model bias analysis. I found a code that is written as follows:
FS = fs_1d(He,Hp,dHw,gamma_sat,model_factor);
M = 1./FS; m = mean(log(M)); s = std(log(M));
A = [ones(11,1) dHw'./He']; para = (A'*A)\A'*log(M');
FS_new = exp(para(1)+para(2)*dHw./He).*fs_1d(He,Hp,dHw,gamma_sat,model_factor);
M_new = 1./FS_new; m_new = mean(log(M_new)); s_new = std(log(M_new));
I am curious about "para" equation in the above code. I believe that equation has a function to correct the FS code. If someone knows about the clear functions or benefits of that equation and the meaning behind the para equation, I would be very glad to hear your opinion. I really look forward to your reply and suggestion. Thank you.
  1 Comment
Jan
Jan on 17 Dec 2017
Well, you should find the explanations of the applied calculations in the documentation of the code. Search either in the header or in the comments on top of the block of code. If there are no comments consider the code as useless. Sorry for this pessimistic view, but I have seen too many code, which have been written with great ideas, but without the wisdom to mention the ideas in the comments. This is a pity.

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 17 Dec 2017
It seems that ‘para’ is a very inefficient least-square parameter estimation assignment (likely explaining the variable name ‘para’). An equivalent (and much more efficient) calculation would simply be:
para = A \ log(M');
It then uses those coefficients to inefficiently plot a fit to the data. A more efficient calculation would be:
exp(A * para)
that is part of the ‘FS_new’ calculation.
It is better to do a nonlinear parameter estimation to directly estimate the ‘para’ parameters, rather than doing to logarithmic mapping. This can easily be done with fminsearch and a couple earlier lines of code.
  2 Comments
Ignatius Tommy Pratama
Ignatius Tommy Pratama on 18 Dec 2017
Thank you much for your response and suggestion. I really appreciate it.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!