You are on page 1of 2

>> x=randn(5,1);dfx=df(x);A=jacnum('f',x);A-dfx

ans =

Columns 1 through 4

7.23825488435637e-08 4.97837859825268e-09 2.55433931783955e-08 -


5.22823238036096e-08

1.92932529952117e-08 8.83111428429118e-09 1.70911540475771e-09 -


2.44537834426239e-10

2.80150063147744e-08 5.15335214501533e-08 1.21278820874871e-08 -


3.75723420154017e-08

2.14268374154614e-08 -3.22906283933833e-08 2.79198536512482e-09 -


2.10734241168353e-08

-1.05367120806221e-07 -3.44734116808354e-08 0 -6.32202725725506e-


08

Column 5

-5.23933294527268e-08

1.59558513068703e-08

-3.40890080607892e-08

2.63417803125776e-08

-1.00098765387635e-07
EXAMEN SEPTIEMBRE 2018

>> em=eps/2;e0=sqrt(em);e1=e0/100;

>> format long

>> x=zeros(3,1);[fx,tx,yx]=tiro(x);nfx=norm(fx);A=jacnum('tiro',x,fx);r=rcond(A);if
r<e1,lambda=e0*norm(A,1);while r<e1,A=A+lambda*eye(size(A));r=rcond(A);end,end,d=-
A\fx;ro=2;

>> ro=ro/2;xn=x+ro*d;[fxn,txn,yxn]=tiro(xn);nfxn=norm(fxn);[nfxn nfx]

ans =

5.381250108723529 9.542992716883692

>> s=xn-x;A=A+(y-A*s)*s'/(s'*s);r=rcond(A);if r<e1,lambda=e0*norm(A,1);while


r<e1,A=A+lambda*eye(size(A));r=rcond(A);end,end,x=xn;fx=fxn;tx=txn;yx=yxn;nfx=nfxn;d=-
A\fx;ro=2;

Undefined function or variable 'y'.

>> s=xn-x;y=fxn-fx;A=A+(y-A*s)*s'/(s'*s);r=rcond(A);if r<e1,lambda=e0*norm(A,1);while


r<e1,A=A+lambda*eye(size(A));r=rcond(A);end,end,x=xn;fx=fxn;tx=txn;yx=yxn;nfx=nfxn;d=-
A\fx;ro=2;

>> ro=ro/2;xn=x+ro*d;[fxn,txn,yxn]=tiro(xn);nfxn=norm(fxn);[nfxn nfx]

ans =

8.710872576191928 5.381250108723529 Que pasa si sale mas grande?

>> [tx' yx']