Solving the problem for the free extremum of a function of several variables - numerical determination local minimum.

์กฐํšŒ ์ˆ˜: 2 (์ตœ๊ทผ 30์ผ)
DS
DS 2024๋…„ 10์›” 18์ผ
ํŽธ์ง‘: Torsten 2024๋…„ 10์›” 21์ผ
Hello, I am trying to do an automatization project, which numericaly determine and writes out the local minimum of given method, also it creates a table and a plot as written below. I am also uploading the .m-files which are also listen in one methon. Thank you for every help or solution in advance.
Task: Find the minimum of the objective function ๐’‡(๐’™, ๐’š) = x^4 + 5x^2 - 9x^2*y + 2y^2 + 2y^4 + 2x
My given starting point for every method is: [0;0.5]
a) by the Newton and Raphson method
b) Levenberg and Marquardt method. Consider ๐›ผ = 8, ๐‘ = 4
c) by the method of conjugate gradients: add function to the konj_tab program (also to graph) and find the minimum for entered starting point and for another selected starting point - at least one different (in each coordinate) from the specified one, I want this: [0.5;1]
d) compare in one image the dependence of the value of the objective function on the iterations (x-axis: number iterations, y-axis: value of the objective function)
For all methods, consider an individually specified starting point. Consider ๐‘”1^2 + ๐‘”2^2 = ๐‘‘ โ‰ค 0.001 as the termination condition of the minimization process, ๐‘”1, ๐‘”2 are gradient components of the gradient โˆ‡๐‘“ = [ g1 ; g2 ].
Solution instructions:
In each method:
- state the basic relationship and briefly describe the procedure, at least 2 steps.
- state the results of the individual calculation steps (in the table).
- draw a contour plot of the function in a range appropriate to the calculated points and plot the points calculated in individual iterations into it.
Evaluate and compare the obtained results. Consider success - whether the method found a local extremum (using the Hessian), accuracy, number of iterations, computational complexity.
  ๋Œ“๊ธ€ ์ˆ˜: 3
Sam Chak
Sam Chak 2024๋…„ 10์›” 18์ผ
The minimum point seems to lie at .
X = linspace(-4, 4, 81);
Y = linspace( 0, 3, 61);
[x, y] = meshgrid(X, Y);
z = x.^4 + 5*x.^2 - 9*(x.^2).*y + 2*y.^2 + 2*y.^4 + 2*x;
figure(1)
surfc(x, y, z),
xlabel('x'), ylabel('y'), zlabel('z')
figure(2)
contour(x, y, z, 50)
xlabel('x'), ylabel('y')
DS
DS 2024๋…„ 10์›” 18์ผ
Thank you, this is only c) by the method of conjugate gradients I guess, for me I got it completely different (see pictures - graph and table), the minimum was (โˆ’0.263, 0.149) , I am attaching the files too I can't guess whats wrong.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

๋‹ต๋ณ€ (1๊ฐœ)

Alan Stevens
Alan Stevens 2024๋…„ 10์›” 21์ผ
Here's a "starter for ten" with the Newton-Raphson method:
% Newton-Raphson Approach
% Function
f = @(x,y)x^4+5*x^2-9*x^2*y+2*y^2+2*y^4+2*x;
% Gradients
gx = @(x,y) 4*x^3+10*x-18*x*y+2;
gy = @(x,y) -9*x^2+4*y+8*y^3;
% Hessian
H = @(x,y) [12*x^2+10-18*y, -18*x;
-18*x, 4+24*y^2];
% Initial guess
x0 = -3; y0 = 3;
tol = 1E-3; err = 1;
maxsteps = 20; steps = 0;
x = x0; y = y0;
while err>tol && steps<maxsteps
steps = steps + 1;
X = [x; y] - H(x,y)\[gx(x,y); gy(x,y)];
err = gx(x,y)^2 + gy(x,y)^2;
x = X(1); y = X(2);
end
disp(['coordinates are: (', num2str(x),' ', num2str(y),')'])
coordinates are: (-2.3734 1.7606)
disp(['in ', int2str(steps), ' steps'])
in 5 steps
disp(['function value is: ', num2str(f(x,y))])
function value is: -8.6924
Note that the results are very sensitive to the initial guesses as is suggested by the contour plot posted by Sam Chak above.
  ๋Œ“๊ธ€ ์ˆ˜: 2
DS
DS 2024๋…„ 10์›” 21์ผ
์ด๋™: Torsten 2024๋…„ 10์›” 21์ผ
Hello thank you, I got this method also completely different I got values: โˆ’0.2638 and 0.1499 with 6 iterations I am attaching the code.
Torsten
Torsten 2024๋…„ 10์›” 21์ผ
ํŽธ์ง‘: Torsten 2024๋…„ 10์›” 21์ผ
Your code for Newton's method is correct. @Alan Stevens chose a different initial point.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Geographic Plots์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by