-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetodosAbiertos.m
100 lines (93 loc) · 1.75 KB
/
MetodosAbiertos.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
clear;
clc;
%% Punto fijo evaluando directamente en la función
%% x=e^(-x) -x
% a=input('Digite el valor semilla: ');
% epsilon=10^-7;
% error=1;
% antx=-1;
% x=a;
% while (error>epsilon)
% antx=x;
% x=exp(-x);
% error=abs((x-antx)/x);
% end
% disp(x);
%% Ejercicio del tanque (Evaluando en la funcion)
% a=input('Digite el valor semilla: ');
% epsilon=10^-7;
% error=1;
% antx=-1;
% x=a;
% x=0:0.01:6;
% plot(x,(pi*(x.^2).*(9-x))/3-30+x);
% while (error>epsilon)
% antx=x;
% x=9-90/(pi*x^2);
% error=abs((x-antx)/x);
% end
% disp(x);
%% Ejercicio del tanque (Utilizando variable simbolica)
% syms h;
% a=input('Digite el valor semilla: ');
% epsilon=10^-7;
% error=1;
% antx=-1;
% x=a;
% f=exp(-h);
% while (error>epsilon)
% antx=x;
% x=subs(f,h,x);
% error=abs((x-antx)/x);
% end
% disp(x);
%% Newton Raphson ()
% syms h;
% a=input('Digite el valor semilla: ');
% epsilon=10^-7;
% error=1;
% antx=-1;
% x=a;
% f=exp(-h)-h;
% maxiter=1000;
% df=diff(f,h);
% i=0;
% while (i<maxiter && error>epsilon)
% antx=x;
% x=x-subs(f,h,x)/subs(df,h,x);
% error=abs((x-antx)/x);
% i=i+1;
% end
% disp(x);
% disp(i);
%% Sin(x)*exp(x)-1 Newton Raphson
% syms h;
% a=input('Digite el valor semilla: ');
% epsilon=10^-7;
% error=1;
% antx=-1;
% x=a;
% f=sin(h)*exp(h)-1;
% maxiter=1000;
% df=diff(f,h);
% i=0;
% while (i<maxiter && error>epsilon)
% antx=x;
% x=x-subs(f,h,x)/subs(df,h,x);
% error=abs((x-antx)/x);
% i=i+1;
% end
% disp(x);
% disp(i);
%%
a=input('Digite el valor semilla: ');
epsilon=10^-7;
error=1;
antx=-1;
x=a;
while (error>epsilon)
antx=x;
x=asin(exp(-x));
error=abs((x-antx)/x);
end
disp(x);