フィルターのクリア

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

1 回表示 (過去 30 日間)
Huda Alzaki
Huda Alzaki 2020 年 10 月 3 日
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 Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by