필터 지우기
필터 지우기

code to find minimum of a quadratic function using newton method with exact line search

조회 수: 1 (최근 30일)
I have wrote this code but I recieve an error meassage , what is the mistake and is the code correct to solve using newton method with exact line search
clearvars;
clc;
syms x y
% b= (x-2)^4 +(x-2*y)^2
b = (x - 2*y)^2 + (x - 2)^4
f = @(x)(x(1)-2)^4 +(x(1)-2*x(2))^2 ;
gradient (b)
b= @ (x,y) (x-2).^4 +(x-2*y).^2
g= @ (x,y)[2*x - 4*y + 4*(x - 2)^3 ; 8*y - 4*x]
B=@(x,y) [2+12*(x-2)^2 -4 ; -4 8 ]
x(1)=0;
y(1)=3;
i=1;
% p = rand(1,1) ;
p1= -B(x,y)\g(x,y);
for i=2:4
x(i) = x(i-1) + p1
y(i) = y(i-1) + p1
p(i) = -B(x(i),y(i))\g(x(i),y(i))
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by