home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 4.ddi / OPTIM.DI$ / CUBICI1.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  548 b   |  16 lines

  1. function r=cubici1(fnew,fold,graddnew,graddold,stepsize)
  2. %CUBICI1 Cubicly interpolates 2 points and gradients to estimate minimum.
  3. %
  4. %    This function uses cubic interpolation and the values of two 
  5. %    points and their gradients in order to estimate the minimum of a 
  6. %    a function along a line.
  7.  
  8. %    Copyright (c) 1990 by the MathWorks, Inc.
  9. %    Andy Grace 7-9-90.
  10.  
  11. if fnew==Inf, fnew=1/eps; end
  12. z=3*(fold-fnew)/stepsize+graddold+graddnew;
  13. w=real(sqrt(z*z-graddold*graddnew));
  14. r=stepsize*((z+w-graddold)/(graddnew-graddold+2*w));
  15.          
  16.