Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solution

0 views
Skip to first unread message

Jafar Sadjadi

unread,
Feb 13, 1998, 3:00:00 AM2/13/98
to

Here is the solution for the computer assignement.

clear
global x;
global g;
x = [0;1];
FF = zeros(2,1);
res = 10;
while res > .0001
FF(1) = x(1)^2-x(2)^2;
FF(2) = 2*x(1)*x(2)-1;
JT = [2*x(1) 2*x(2);-2*x(2) 2*x(1)];
g = JT*FF
alpha = fmin('test',0,1)
x = x - alpha *g
res = norm(g);
end

function [f] = f(alpha)
global x;
global g;
dir = zeros(2,1);
dir = x - alpha * g;
f = (dir(1)^2-dir(2)^2)^2+(2*dir(1)*dir(2)-1)^2;


0 new messages