Question: % Objective Function to be minimized function f = f ( x , y , z ) f = 1 0 0 * x ^
Objective Function to be minimized
function f fx y z
f x yz xy xy x y z ;
end
Gradient of the function
function g gradx y z
g xyy x z z y ;
end
Step size for the gradient descent
alpha ;
Maximum number of iterations
maxIter ;
Stopping criteria
epsilon e;
Starting point
x;
Current point
x x;
Previous point
xPrev zerossizex;
Iteration counter
k ;
Gradient descent loop
while k maxIter && euclideanNormx xPrev epsilon
Update the previous point
xPrev x;
Compute the gradient at the current point
g gradx x x;
Update the current point
x x alpha g;
x x alpha g;
x x alpha g;
Increase the iteration counter
k k ;
end
Print the result
dispLocal optima: numstrx;
Euclidean norm
function n euclideanNormx y z
n sqrtsumx yz;
end
What is the error here, I want to output the local minima of objective function
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
