Académique Documents
Professionnel Documents
Culture Documents
>> x=-5:0.1:0;
f=
Inline function:
f(x) = sin(x)-0.5*exp(x)
>> r(1)=-4;
>> syms x
>> r(2)=r(1)-f(r(1))/subs(diff(f(x)),R(1))
>> r(2)=r(1)-f(r(1))/subs(diff(f(x)),r(1))
r=
-4.0000 -2.8720
>> r(3)=r(2)-f(r(2))/subs(diff(f(x)),r(2))
r=
>> e(1==inf
e(1==inf
>> e(1)=inf
e=
Inf
>> e(2)=abs(r(2)-r(1))
e=
Inf 1.1280
>> e(3)=abs(r(3)-r(2))
e=
>> r(4)=r(3)-f(r(3))/subs(diff(f(x)),r(3))
r=
>> e(4)=abs(r(4)-r(3))
e=
>> r(5)=r(4)-f(r(4))/subs(diff(f(x)),r(4))
r=
>> e(5)=abs(r(5)-r(4))
e=
EJEMPLO 2
>> clear
>> x=0:0.1:50;
>> x=0:0.1:50;
>> f=inline('-x+1.14-2*log10((0.0025/0.1)+9.35*x/3e4)')
f=
Inline function:
f(x) = -x+1.14-2*log10((0.0025/0.1)+9.35*x/3e4)
>> plot(x,f(x));grid minor
>> r(1)=5
r=
>> syms x
r=
5.000000000000000 4.298746274352372
>> e(1)=inf
e=
Inf
>> e(2)=abs(r(2)-r(1))
e=
Inf 0.701253725647628
>> e(3)=abs(r(3)-r(2))
e=
r=
>> e(4)=abs(r(4)-r(3))
e=
>> f=(1/r(4))^2
f=
0.054114102559008
METODO PUNTO FIJO
>> x=-2:0.1:2;
>> f=inline('x.^2-3*x+exp(x)-2')
f=
Inline function:
f(x) = x.^2-3*x+exp(x)-2
>> g=inline('x')
g=
Inline function:
g(x) = x
>> hold on
>> plot(x,g(x),'r')
>> h=inline('(x.^2+exp(x)-2)/3')
h=
Inline function:
h(x) = (x.^2+exp(x)-2)/3
>> plot(x,h(x),'m')
>> 0
ans =
>> x(1)=1
x=
Columns 1 through 4
Columns 5 through 8
Columns 9 through 12
Columns 13 through 16
Columns 17 through 20
Columns 25 through 28
Columns 29 through 32
Columns 33 through 36
Columns 37 through 40
Column 41
2.000000000000000
>> h(x(1))
ans =
0.572760609486349
>> x(2)=h(x(1))
x=
Columns 1 through 4
Columns 5 through 8
Columns 9 through 12
Columns 13 through 16
Columns 17 through 20
Columns 21 through 24
Columns 29 through 32
Columns 33 through 36
Columns 37 through 40
Column 41
2.000000000000000
>> h(x(2))
ans =
0.033736668721494
>> x(3)=h(x(x(2)));
>> h(x(3))
ans =
-0.321516544358344
>> x(4)=h(x(3));
>> h(x(4))
ans =
-0.390526159080027
>> e(1)=inf
e=
Inf
>> e(2)=abs(x(2)-x(1))
e=
Inf 0.427239390513651
>> e(3)=abs(x(3)-x(2))
e=
Inf 0.427239390513651 0.539023940764855
>> e(4)=abs(x(4)-x(3))
e=
>> x(5)=h(x(4));
>> h(x(5))
ans =
-0.390262863498443
>> e(5)=abs(x(5)-x(4))
e=
Columns 1 through 4
Column 5
0.069009614721683
>> h(x(6))
ans =
0.157710053382810
>> x(6)=h(x(5));
>> e(6)=abs(x(6)-x(5))
e=
Columns 1 through 4
Columns 5 through 6
0.069009614721683 0.000263295581585
>> h(x(6))
ans =
-0.390271991008394
>> e(7)=abs(x(7)-x(6))
e=
Columns 1 through 4
Inf 0.427239390513651 0.539023940764855 0.355253213079838
Columns 5 through 7
>> x(7)=h(x(6));
>> h(x(7))
ans =
-0.390271675625484
>> e(7)=abs(x(7)-x(6))
e=
Columns 1 through 4
Columns 5 through 7
>>