I am trying to implement steepest descent algorithm for minimization of 2D function. Let me explain with example.
I have function f1(x1,x2) = 2*x1^2 + x2^2 - 5*x1*x2 and starting with initial guess point p0 = [1,0].
Step 1: Initial guess point p0 = [1,0], convergence parameter e=0.1
Step 2: calculate gradient c1 of f1 at p0. c1=[4,-5] I am using central difference method for that.
Step 3: If norm of c1>e, go to step 4, otherwise stop.
Step 4: Our direction of search is d1 = - c1. So, d1 = [-4,5].
Step 5: Find step size a to minimize f1(a) = f1(p0 + a*d1) = f1(1-4a,5a)
Step 6: Update p0 to p1 as p1 = p0 + a * d1 and to to step 2.
I am trying to implement this example in matlab and do not know how to implement step 5. I know that ant 1D search algorithm, such as bisection method can work. But, problem is to 'converting' f1(1-4a,5a) to a function, that is, substituting (1-4a,5a) into f1. I encounter symbolic constant a here, which I do not know how to deal with. If I write a minimization function, I can pass values to it, but not sure about symbolic variable a. I do not want to use special features of matlab, such as symbolics and trying to keep code at general level, so I can convert it into other programming languages without any problems. Your suggestions are welcome.