Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% Objective Function to be minimized function f = f ( x , y , z ) f = 1 0 0 * x ^

% Objective Function to be minimized
function f = f(x, y, z)
f =100*x^2+ y^2+0.1*z^2+ x*y +0.1*x*y -6*x +4*y +6*z +15;
end
% Gradient of the function
function g = grad(x, y, z)
g =[200*x+y-6,2*y + x +0.1*z +4,0.2*z +0.1*y +6];
end
% Step size for the gradient descent
alpha =0.1;
% Maximum number of iterations
maxIter =100;
% Stopping criteria
epsilon =1e-4;
% Starting point
x0=[10,10,10];
% Current point
x = x0;
% Previous point
xPrev = zeros(size(x0));
% Iteration counter
k =0;
% Gradient descent loop
while k < maxIter && euclideanNorm(x, xPrev)> epsilon
% Update the previous point
xPrev = x;
% Compute the gradient at the current point
g = grad(x(1), x(2), x(3));
% Update the current point
x(1)= x(1)- alpha * g(1);
x(2)= x(2)- alpha * g(2);
x(3)= x(3)- alpha * g(3);
% Increase the iteration counter
k = k +1;
end
% Print the result
disp(['Local optima: ', num2str(x)]);
% Euclidean norm
function n = euclideanNorm(x, y, z)
n = sqrt(sum((x - y)-z).^2);
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

Explain the focus of safety programs.

Answered: 1 week ago

Question

Describe the consequences of musculoskeletal disorders.

Answered: 1 week ago