Вы находитесь на странице: 1из 12

%METODO PUNTO FIJO

%ALUMNA: EMPERATRIZ PRIMO FABIAN


%CURSO: MTODOS NUMRICOS Y PROGRAMACION
%EJERCICIO: N 01
x=-5:0.05:3;
f=(cos(2*x)+exp(-x)-4*x.^2-x+9);
plot(x,f,'r')
grid on
xlabel('ABSISAS')
ylabel('COORDENADAS')
title('GRAFICA DE PUNTO FIJO')
legend('f=(cos(2*x)+exp(-x)-4*x.^2-x+9')
gtext('f=(cos(2*x)+exp(-x)-4*x.^2-x+9)')
gtext('RAIZ1')
gtext('RAIZ2')
gtext('RAIZ3')
HALLAR LA SOLUCION DE:
f ( x) cos 2 * x e x 4 * x 2 x 9
i.

x 5;3

GRAFICANDO
GRAFICA DE PUNTO FIJO

70

f=(cos(2*x)+exp(-x)-4*x. 2-x+9

60
50

COORDENADAS

40
30
20

f=(cos(2*x)+exp(-x)-4*x. 2-x+9)

10

RAIZ2

RAIZ1

RAIZ3

-10
-20
-30
-5

ii.

-4

-3

-2

-1
ABSISAS

Construyendo las funciones g(x)


a) f(x)=0

cos 2 * x e x 4 * x 2 x 9 0

x cos 2 * x e x 4 * x 2 9

x g ( x); g ( x) cos 2 * x e

4 * x2 9

b) f(x)=0

cos 2 * x e x 4 * x 2 x 9 0
e x cos 2 * x 4 * x 2 x 9

ln e x ln cos 2 * x 4 * x 2 x 9

x ln cos 2 * x 4 * x x 9
2

x g ( x); g ( x) ln cos 2 * x 4 * x 2 x 9
c) f(x)=0

cos 2 * x e x 4 * x 2 x 9 0
4 * x 2 x cos 2 * x e x 9

x 4 * x 1 cos 2 * x e x 9
cos 2 * x e x 9

4 * x 1

cos 2 * x e x 9
x g ( x); g ( x)

4 * x 1

d) f(x)=0

cos 2 * x e x 4 * x 2 x 9 0
4 * x 2 cos 2 * x e x x 9
x

cos 2 * x e x x 9
4

cos 2 * x e x x 9
x
4
x1 g ( x); g ( x)

cos 2 * x e x x 9
4

x1 g ( x); g ( x)

cos 2 * x e x x 9
4

e) f(x)=0

cos 2 * x e x 4 * x 2 x 9 0
cos 2 * x e x 4 * x 2 x 9

ex 4 * x 2 x 9

x arccos

ex 4 * x 2 x 9

x g ( x); g ( x ) arccos
iii.

Analizando convergencia de HANS BANASH


CONVERGENCIA DE HANS BANASH

%CONVERGENCIA DE HANS - BANASH


g1=cos(2*x)+epx(-x)-(4*(x.^2))+9;
g1=-log((-cos(2*x))+(4*(x.^2))+x-9);
g1=((cos(2*x)+exp(-x)+9)./(4*x+1));
g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));
g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));
g1=acos(((-epx(-x))+4*(x.^2)+x-9)/2);
%ANALIZANDO g(X)
syms x
a=1.5;
g1=cos(2*x)+exp(-x)-(4*(x.^2))+9;
g11=eval(subs(diff(g1,1),a))
g11 =
-12.5054..> 1 (no)
g1=-log((-cos(2*x))+(4*(x.^2))+x-9);
g12=eval(subs(diff(g1,1),a))
g12 =
-5.3342..> 1 (no)
g1=((cos(2*x)+exp(-x)+9)./(4*x+1));
g13=eval(subs(diff(g1,1),a))
g13 =
-0.7443..< 1 (si)
g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));
g14=eval(subs(diff(g1,1),a))
g14 =
0.1450..< 1 (si)
g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));
g15=eval(subs(diff(g1,1),a))
g15 =
-0.1450..< 1 (si)

g1=acos(((-exp(-x))+4*(x.^2)+x-9)/2);
g16=eval(subs(diff(g1,1),a))
g16 =
-8.5901..> 1 (no)
iv)
Iteraciones
Luego gconverge en x0=3/2
n=0

iteraciones

x n 1 g ( x n )

cos 2 * x 0 e x0 9
x1

4 * x 0 1

1.5
cos 2 * 1.5 e 9
x1

4 * 1.5 1

x1 1.1762
n=1

cos 2 * x1 e x1 9
x2

4 * x1 1

1.1762
cos 2 * 1.1762 e
9
x2

4 * 1.1762 1

x 2 1.5082
n=2

cos 2 * x 2 e x2 9
x3

4 * x2 1

1.5082
cos 2 * 1.5082 e
9
x3

4 *1.5082 1

x3 1.1701

puntofijo
Ingrese la funcin del punto fijo g(x)=((cos(2*x)+exp(-x)+9)./(4*x+1))
ingrese el valor inicial xo= 1.5
it aprox g(x) error
1 1.500000 1.176163
2 1.176163 1.508260
3 1.508260 1.170064
4 1.170064 1.516603
5 1.516603 1.164003
6 1.164003 1.524986
7 1.524986 1.158012
8 1.158012 1.533362

0.275334
0.220186
0.289041
0.228497
0.302920
0.236712
0.316900
0.244789

9 1.533362 1.152123
10 1.152123 1.541685
11 1.541685 1.146367
12 1.146367 1.549906
13 1.549906 1.140773
14 1.140773 1.557976
15 1.557976 1.135370
16 1.135370 1.565850
17 1.565850 1.130181
18 1.130181 1.573484
La raz es :1.573483832

0.330902
0.252686
0.344845
0.260364
0.358645
0.267785
0.372219
0.274918
0.385486
0.281733

%ANALIZANDO g(X)
syms x
a=-5/2;
g1=cos(2*x)+exp(-x)-(4*(x.^2))+9;
g11=eval(subs(diff(g1,1),a))
g11 =
5.8997 > 1 (NO)
g1=-log((-cos(2*x))+(4*(x.^2))+x-9);
g12=eval(subs(diff(g1,1),a))
g12 =
1.2925 > 1 (NO)
g1=((cos(2*x)+exp(-x)+9)./(4*x+1));
g13=eval(subs(diff(g1,1),a))
g13 =
0.5066..< 1 (SI)
g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));
g14=eval(subs(diff(g1,1),a))
g14 =
0.7711..< 1 (SI)
g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));
g15=eval(subs(diff(g1,1),a))
g15 =
-0.7711..< 1 (SI)
g1=acos(((-exp(-x))+4*(x.^2)+x-9)/2);
g16=eval(subs(diff(g1,1),a))
g16 =
4.5308 > 1 (NO)
iv)
Iteraciones
Luego gconverge en x0=-5/2
n=0

iteraciones

x n 1 g ( x n )

x1

cos 2 * x1 e x1 x1 9
4

cos 2 * 2.5 e 2.5 2.5 9


x1
4
x1 2.4478
n=1

x2

cos 2 * x1 e x1 x1 9
4

cos 2 * 2.4478 e 2.4478 2.4478 9


4
x 2 2.4079
x2

n=2

cos 2 * x 2 e x2 x 2 9
x3
4
cos 2 * 2.4079 e 2.4079 2.4079 9
4
x3 2.3781
x3

puntofijo
Ingrese la funcin del punto fijo g(x)=(-sqrt((cos(2*x)+exp(-x)-x+9)/4))
ingrese el valor inicial xo= -5/2
it aprox g(x) error
1 -2.500000 -2.447762
2 -2.447762 -2.407920
3 -2.407920 -2.378130
4 -2.378130 -2.356200
5 -2.356200 -2.340245
6 -2.340245 -2.328741
7 -2.328741 -2.320499
8 -2.320499 -2.314623
9 -2.314623 -2.310448
10 -2.310448 -2.307489
11 -2.307489 -2.305396
12 -2.305396 -2.303916
13 -2.303916 -2.302871
14 -2.302871 -2.302134
15 -2.302134 -2.301615
16 -2.301615 -2.301248
17 -2.301248 -2.300990
18 -2.300990 -2.300808
La raz es :-2.300807674

0.021341
0.016546
0.012527
0.009308
0.006817
0.004940
0.003552
0.002539
0.001807
0.001282
0.000908
0.000642
0.000454
0.000320
0.000226
0.000159
0.000112
0.000079

%ANALIZANDO g(X)
syms x
a=-7/2;
g1=cos(2*x)+exp(-x)-(4*(x.^2))+9;
g11=eval(subs(diff(g1,1),a))
g11 =
-3.8015 > 1 (NO)
g1=-log((-cos(2*x))+(4*(x.^2))+x-9);
g12=eval(subs(diff(g1,1),a))
g12 =
0.7921..< 1 (SI)
g1=((cos(2*x)+exp(-x)+9)./(4*x+1));
g13=eval(subs(diff(g1,1),a))
g13 =
1.4316 > 1 (NO)
g1=(-sqrt((cos(2*x)+exp(-x)-x+9)/4));
g14=eval(subs(diff(g1,1),a))
g14 =
1.2043 > 1 (NO)
g1=(sqrt((cos(2*x)+exp(-x)-x+9)/4));
g15=eval(subs(diff(g1,1),a))
g15 =
-1.2043 > 1 (NO)
g1=acos(((-exp(-x))+4*(x.^2)+x-9)/2);
g16=eval(subs(diff(g1,1),a))
g16 =
1.0
.2398i > 1 (NO)
iv) Iteraciones
Luego gconverge en x0=7/2
n=0

iteraciones

x n 1 g ( x n )

x1 ln cos 2 * x 0 4 * x0 x0 9
2

x1 ln cos 2 * 3.5 4 * 3.5 2 3.5 9

x 1 3.5764
n=1

x 2 ln cos 2 * x1 4 * x1 x 1 9

x 2 ln cos 2 * 3.5764 4 * 3.5764 2 3.5764 9


x 2 3.6360
n=2

x3 ln cos 2 * x 2 4 * x 2 x 2 9
2

x3 ln cos 2 * 3.6360 4 * 3.6360 2 3.6360 9

x3 3.6813
puntofijo
Ingrese la funcin del punto fijo g(x)=-log((-cos(2*x))+(4*(x.^2))+x-9)
ingrese el valor inicial xo= -7/2
it aprox g(x) error
1 -3.500000 -3.576441
2 -3.576441 -3.636065
3 -3.636065 -3.681307
4 -3.681307 -3.714911
5 -3.714911 -3.739472
6 -3.739472 -3.757212
7 -3.757212 -3.769913
8 -3.769913 -3.778950
9 -3.778950 -3.785351
10 -3.785351 -3.789870
11 -3.789870 -3.793054
12 -3.793054 -3.795294
13 -3.795294 -3.796867
14 -3.796867 -3.797972
15 -3.797972 -3.798747
16 -3.798747 -3.799291
17 -3.799291 -3.799672
18 -3.799672 -3.799939
La raz es :-3.799938890

0.021374
0.016398
0.012290
0.009046
0.006568
0.004721
0.003369
0.002391
0.001691
0.001193
0.000839
0.000590
0.000414
0.000291
0.000204
0.000143
0.000100
0.000070

%METODO PUNTO FIJO


%ALUMNA: EMPERATRIZ PRIMO FABIAN
%CURSO: MTODOS NUMRICOS Y PROGRAMACION
%EJERCICIO: N 02
x=-2:0.05:5;
f=((x.^2-3*x+4*sin(x)).*(x+4)-5);
plot(x,f,'r')
grid on
xlabel('ABSISAS')
ylabel('COORDENADAS')
title('GRAFICA DE PUNTO FIJO')
legend('=((x.^2-3*x+4*sin(x)).*(x+4)-5)')
gtext('f==((x.^2-3*x+4*sin(x)).*(x+4)-5)')
gtext('RAIZ1')
gtext('RAIZ2')
gtext('RAIZ3')
gtext('RAIZ3')
HALLAR LA SOLUCION DE:

f ( x) x 2 3 * x 4 * sin( x) * x 4 5
i.

x 2;5

GRAFICANDO
GRAFICA DE PUNTO FIJO

60

=((x. 2-3*x+4*sin(x)).*(x+4)-5)
50

COORDENADAS

40
30
20
10

ii.

f==((x.2-3*x+4*sin(x)).*(x+4)-5)

RAIZ1

-10
-2

-1

RAIZ2

1
2
ABSISAS

Construyendo las funciones g(x)


a) f(x)=0

x
x

5
3 * x 4 * sin( x )
( x 4)

3 * x 4 * sin( x ) * x 4 5

1
5
x
x 2 4 * sin( x)
3 ( x 4)

b) f(x)=0

RAIZ3

RAIZ4

x
x

5
3 * x 4 * sin( x )
x 4

3 * x 4 * sin( x ) * x 4 5

sin( x)

1
5

x 2 3 * x
4 x 4

1
5
x arcsen
x 2 3 * x
4 x 4

c) f(x)=0

3 * x 4 * sin( x ) * x 4 5
5
x2
4 * sin( x) 3 * x
x 4
2

5
4 * sin( x) 3 * x
x 4

5
4 * sin( x ) 3 * x
x 4

d) f(x)=0

3 * x 4 * sin( x) * x 4 5

5
4
x 3 * x 4 * sin( x)
5
x g ( x); g ( x) 2
4
x 3 * x 4 * sin( x)
x

e) f(x)=0

3 * x 4 * sin( x ) * x 4 5 0
5
x 2 3x
4senx
( x 4)
5
x( x 3)
4 senx
( x 4)
g ( x) x.
2

g ( x) (

5
1
4 senx ) *
( x 5)
( x 3)

x=-2:0.05:5;
f=(x.^2-3*x+4*sin(x)).*(x+4)-5;
plot(x,f,'m')
grid on

%Analizando Convergencia
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3);
subs(diff(g,1),-3/2)
g=-0.6390
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3);
subs(diff(g,1),1/2)
g=1.5857
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3);
subs(diff(g,1),5/2)
g=0.6379

syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3);
subs(diff(g,1),7/2)
= 1.1144

%Valor Numerico
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3);
subs(g,2)
= 2.2680
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3);
subs(g,3)
g=2.9501
%Iteraciones
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3)
subs(g,5/2)
g=2.6249
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3)
subs(g,2.6249)
g=2.7038
syms x
g=(((x.^2+4*sin(x))-5/(x+4))./3)
subs(g, 2.7038)
g=2.7535

puntofijo
Ingrese la funcin del punto fijo g(x)=(((x.^2+4*sin(x))-5/(x+4))./3)
ingrese el valor inicial xo= 5/2
it aprox g(x) error
1 2.500000 2.624886
2 2.624886 2.703791
3 2.703791 2.753479
4 2.753479 2.785020
5 2.785020 2.805226
6 2.805226 2.818267
7 2.818267 2.826730
8 2.826730 2.832244
9 2.832244 2.835845
10 2.835845 2.838201
11 2.838201 2.839744
12 2.839744 2.840756
13 2.840756 2.841420
14 2.841420 2.841855
15 2.841855 2.842141
16 2.842141 2.842328
17 2.842328 2.842451
18 2.842451 2.842532
La raz es :2.842532141

0.047578
0.029183
0.018045
0.011325
0.007203
0.004627
0.002994
0.001947
0.001270
0.000830
0.000543
0.000356
0.000234
0.000153
0.000101
0.000066
0.000043
0.000028

Вам также может понравиться