Академический Документы
Профессиональный Документы
Культура Документы
Autor
Alumno: Arnold Claudio Espinoza Snchez
Profesor
LIC. Braulio Gutirrez Par
pg. 1
Algoritmo:
function Aisla_Raices
x = 0 :10;
y = f(x);
y=sqrt(x)-5*exp(-x);
plot(x,y), grid
aisla = [ ];
for i = 1:length(x) - 1;
if y(i)*y(i + 1)<0, aisla=[aisla; x(i) x(i+1)];
end
end
disp('Intervalos que contienen raices...'); disp(aisla)
Resultado:
Aisla_Raices
c=
Columns 1 through 9
-1.0000 0.9172 1.9911 1.2344 -0.6572 -1.9446 -1.4441
Columns 10 through 11
1.6249 -0.1032
Intervalos que contienen races...
1 2
Eso quiere decir que hay races en los intervalos 1-2
0.3840
1.8591
b) f (x) = x4 2x
pg. 2
Algoritmo:
function Aisla_Raices
x = 0 :10;
y = f(x);
y = x.^4-2*x
plot(x,y), grid
aisla = [ ];
for i = 1:length(x) - 1;
if y(i)*y(i + 1)<0, aisla=[aisla; x(i) x(i+1)];
end
end
disp('Intervalos que contienen raices...'); disp(aisla)
Resultado:
Aisla_Raices
c=
Columns 1 through 9
-1.0000 0.9172 1.9911 1.2344 -0.6572 -1.9446 -1.4441
Columns 10 through 11
1.6249 -0.1032
y=
Columns 1 through 7
0
-1
12
75
248
615
1284
Columns 8 through 11
2387
4080
6543
9980
Intervalos que contienen races...
1 2
0.3840
1.8591
Ejercicio 0.2 En Matlab haga un programa que aisl las races de la funcin f (x) = e^(x/3)/2sen(x) del intervalo [10; 10] y que muestre grficamente.
1. Creamos la funcin siguiente
function y = f (x)
y = 1/2 exp(x/3) sen(x);
pg. 3
Algoritmo:
function Aisla_Raices
x = -10 :10;
y = f(x);
y = 1/2*exp(x/3)-sin(x);
plot(x,y), grid
aisla = [ ];
for i = 1:length(x) - 1;
if y(i)*y(i + 1)<0, aisla=[aisla; x(i) x(i+1)];
end
end
disp('Intervalos que contienen raices...'); disp(aisla)
Resultado:
Aisla_Raices
c=
Columns 1 through 19
1.7813 0.1973 -1.5681 -1.8918 -0.4762 1.3772 1.9645 0.7456 -1.1588 -1.9978 -1.0000
0.9172 1.9911 1.2344 -0.6572 -1.9446 -1.4441 0.3840 1.8591
Columns 20 through 21
1.6249 -0.1032
Intervalos que contienen raices...
-10 -9
-7 -6
-4 -3
0 1
1 2
Ejercicio 0.3 Aisl por lo menos una raz de las funciones dadas en el intervalo [0; 10]
El algoritmo siguiente es igual para estos ejercicios con la diferencia de la funcin que
existe en el algoritmo:
1. a) f (x) = e^x 2 x
Resultado:
Aisla_Raices
c=
pg. 4
0.3840
1.8591
1.6249 -
0.3840
1.8591
1.6249 -
b) f (x) = cos(x) + 1 x
Aisla_Raices
c=
-1.0000 0.9172
0.1032
c) f (x) = ln(x) 5 + x
Resultado:
Aisla_Raices
c=
pg. 5
0.9172
1.9911
0.3840
1.8591
Columns 10 through 11
1.6249 -0.1032
Intervalos que contienen raices...
3
0.1032
Intervalos que contienen raices...
3
pg. 6
e) F(x) = x-3^-x
Resultado:
Aisla_Raices
c=
Columns 1 through 9
-1.0000
0.9172
1.9911
0.3840
1.8591
0.3840
1.8591
Columns 10 through 11
1.6249 -0.1032
Intervalos que contienen raices...
0
f) F(x) = 4*x^2-exp(x)
Aisla_Raices
c=
Columns 1 through 9
-1.0000
0.9172
1.9911
Columns 10 through 11
1.6249 -0.1032
Intervalos que contienen raices...
pg. 7
g) y=x^3-2*x^2-4*x+3
Aisla_Raices
c=
Columns 1 through 9
-1.0000
0.9172
1.9911
0.3840
1.8591
0.3840
1.8591
Columns 10 through 11
1.6249 -0.1032
Intervalos que contienen raices...
0
h) y=(x-2).^2-log(x)
Resultado:
Aisla_Raices
c=
Columns 1 through 9
-1.0000
0.9172
1.9911
Columns 10 through 11
pg. 8
0.9172
1.9911
0.3840
1.8591
Columns 10 through 11
1.6249 -0.1032
y=
Columns 1 through 9
-Inf -1.0000
0.6931
2.0986
3.3863
4.6094
5.7918
6.9459
8.0794
Columns 10 through 11
9.1972 10.3026
Intervalos que contienen raices...
1
pg. 9