Index: mttroot/mtt/lib/control/PPP/ppp_optimise.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_optimise.m +++ mttroot/mtt/lib/control/PPP/ppp_optimise.m @@ -26,10 +26,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ + ## Revision 1.7 2001/08/10 16:19:06 gawthrop + ## Tidied up the optimisation stuff + ## ## Revision 1.6 2001/07/03 22:59:10 gawthrop ## Fixed problems with argument passing for CRs ## ## Revision 1.5 2001/06/06 07:54:38 gawthrop ## Further fixes to make nonlinear PPP work ... @@ -70,13 +73,13 @@ if n_dataextras.criterion)&&\ - (abs(error)>extras.criterion)&&\ + (abs(err)>extras.criterion)&&\ (iterations1 # Adjust the Levenberg-Marquardt parameter - reduction = error_old-error; + reduction = err_old-err; predicted_reduction = 2*J'*step + step'*JJ*step; r = predicted_reduction/reduction; if (r<0.25)||(reduction<0) v = 4*v; elseif r>0.75 @@ -146,12 +149,12 @@ v = v/2; endif if reduction<0 # Its getting worse par(i_t) = par(i_t) + step; # rewind parameter - error = error_old; # rewind error - error_old = error_old_old; # rewind old error + err = err_old; # rewind error + err_old = err_old_old; # rewind old error if extras.verbose printf(" Rewinding ....\n"); endif endif endif @@ -158,21 +161,21 @@ ## Compute step using pseudo inverse JJL = JJ + v*eye(n_th); # Levenberg-Marquardt term step = pinv(JJL)*J; # Step size par(i_t) = par(i_t) - step; # Increment parameters - error_old_old = error_old; # Save old error - error_old = error; # Save error + err_old_old = err_old; # Save old error + err_old = err; # Save error ##Some diagnostics - Error = [Error error]; # Save error + Error = [Error err]; # Save error Par = [Par par]; # Save parameters Y = [Y y]; # Save output if extras.verbose # Diagnostics printf("Iteration: %i\n", iterations); - printf(" error: %g\n", error); + printf(" error: %g\n", err); printf(" reduction: %g\n", reduction); printf(" prediction: %g\n", predicted_reduction); printf(" ratio: %g\n", r); printf(" L-M param: %g\n", v); printf(" parameters: ");