Skip to content

Instantly share code, notes, and snippets.

@agirault
Created March 26, 2014 15:20
Show Gist options
  • Save agirault/9785832 to your computer and use it in GitHub Desktop.
Save agirault/9785832 to your computer and use it in GitHub Desktop.
minimize phi(alpha) using a cubic model - linesearch with step length selection
M1 = [alpha_prev^2, -alpha_cur^2; -alpha_prev^3, alpha_cur^3];
M2 = [phi_alpha - phi_0 - phiP_0*alpha_cur; phi_prev - phi_0 - phiP_0*alpha_prev];
M = M1 * M2 * 1/(alpha_prev^2 * alpha_cur^2 * (alpha_cur - alpha_prev));
a = M(1);
b = M(2);
alpha = (-b + sqrt(b*b - 3*a*phiP_0))/(3*a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment