help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nonlin_min function


From: Steph Bredenhann
Subject: Re: nonlin_min function
Date: Mon, 6 Apr 2020 07:49:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1


On 2020/04/06 04:42, Kai Torben Ohlhus wrote:
On 4/5/20 9:59 PM, Steph Bredenhann wrote:
I'll appreciate some help with the nonlin_min function

My code is as follows and the objective function is included as a
separate file. My problem is that GPL_x, the column vector of unknowns
to be solved is returned as GPL_x0, the seed values.

% initialise the GPL parameters
GPL_x = [0; 0; 0];  % in order D0 D1 m
% the first estimate of model parameters
% in the GPL model D(t) = D0 + D1*(t)^m
GPL_D0 = 0.0006; %0.000626249601623718;
GPL_D1 = 0.0001; %0.000107587010307332;
GPL_m  = 0.3     %0.312356329396664;
% D_test = fn_GPL_model (GPL_D0, GPL_D1, GPL_m, BBR_tr) GPL_D  = BBR_D(1,:);
GPL_tr = BBR_tr(1,:);
for ii = 2 : rows(BBR_D)
   GPL_D  = [GPL_D, BBR_D(ii,:)];
   GPL_tr = [GPL_tr, BBR_tr(ii,:)];
endfor
fun_GPL = @(GPL_x)fn_BBR_GPL_RMSE (GPL_x, GPL_D, GPL_tr);
%GPL_x0_lb = [1000.0; 1.0e6; 0.1; 0.0];
%GPL_x0_ub = [3000.0; 4.0e6; 0.9; 1.0];
GPL_x0 = [GPL_D0; GPL_D1; GPL_m];
[GPL_x, GPL_RMSE, cvg, outp] =...
    nonlin_min(fun_GPL, GPL_x0);
GPL_D0 = GPL_x(1);
GPL_D1 = GPL_x(2);
GPL_m  = GPL_x(3);
I'll appreciate some advice, thank you very much.

--
*/Steph Bredenhann/*


Dear Steph Bredenhann,

In your code, the variables "BBR_D" and "BBR_tr" are not defined.
Please, can you send a minimal working example to reproduce your problem?

Kai

Dear Kai

The variables are as follows, and please note that the values after % for GPL_Do, etc are the values as calculated with Excel SOLVE function:

BBR_S =

    120.272     93.782     69.465     49.861     34.546     22.970
    276.088    230.073    185.954    145.986    111.780     83.573
    550.313    483.285    414.183    347.850    286.163    228.998
    720.538    671.688    605.032    547.171    480.848    415.814
   1006.866    947.639    886.043    822.754    739.724    667.029

BBR_D = 1./BBR_S

>> BBR_D
BBR_D =

   0.00831449   0.01066299   0.01439580   0.02005593 0.02894722   0.04353450    0.00362203   0.00434644   0.00537768   0.00684999 0.00894616   0.01196564    0.00181715   0.00206917   0.00241439   0.00287480 0.00349451   0.00436684    0.00138785   0.00148879   0.00165280   0.00182758 0.00207966   0.00240492    0.00099318   0.00105525   0.00112861   0.00121543 0.00135186   0.00149918

>> BBR_tr
BBR_tr =

     434631.32360     814933.73175    1629867.46349 3259734.92699    6519469.85398   13038939.70796       29101.54173      54565.39075     109130.78150 218261.56301     436523.12602     873046.25204        1565.26858       2934.87860       5869.75719 11739.51438      23479.02877      46958.05753         149.31155        279.95915        559.91830 1119.83659       2239.67319       4479.34638           8.00000         15.00000         30.00000 60.00000        120.00000        240.00000

>>
--
Steph



reply via email to

[Prev in Thread] Current Thread [Next in Thread]