Está en la página 1de 8

PRACTICA Nº4

METODOS NUMERICOS

ANDRES CARDOSO VELACO ICI

1)

a) crear un programa que ingrese un numero n (entero mayor que 3), y realice el siguiente
producto: 2*6*10*18*...*n
function serie
n=input('ingrese numero n :')
if n>=3
s=1;
i=2;
while i<=n
s=s*i;
i=i+4;
end
end
disp('el resultado es: ')
disp(s)

>> serie
ingrese número n :20
n =20
el resultado es:
30240

b) crear un programa donde se introduzca dos funciones, y se realicé un panel de grafico de


1x2

function graficos
syms x1 x2 y1 y2
x1=-5:0.01:5;
x2=-5:0.01:5;
f=input('ingrese primera funcion: ','s');
y1=inline(f);
g=input('ingrese segunda funcion: ','s');
y2=inline(g);
subplot(1,2,1),plot(x1,y1)
subplot(1,2,2),plot(x2,y2)
2.- DETERMINE MEDIANTE METODO GRAFICO

a) >> syms x

>> x=-5:0.01:5;

>> y=x.^2-7*x+2;

>> plot(x,y),grid

b) >> syms x

>> x=-5:0.01:5;

>> y=x.^3+x-5;

>> plot(x,y),grid

c) >> syms x

>> x=-5:0.01:5;

>> y=x.^4+2*x.^2+1;

>> plot(x,y),grid
NO TIENE SOLUCION

d) >> syms x

>> x=-5:0.01:5;

>> y=exp(-x)+x.^2-6;

>> plot(x,y),grid

e) >> syms x

>> x=-5:0.01:5;

>> y=log(x)+x.^2-5;

>> plot(x,y),grid
3) DETERMINE SI EXITE LA SOLUCION MEDIANTE METODO BISECCION

a) >> syms x
>> x=-5:0.01:5;
>> y=x.^2-7*x+2;
>> plot(x,y),grid

SI TIENE SOLUCION

ingrese la funcion: x.^2-7*x+2;


ingrese a: 0
ingrese b: 1
ingrese numero de iteraciones n: 3
f =Inline function:
f(x) = x.^2-7*x+2;
el resultado es: 0.3750

b) >> syms x
>> x=-5:0.01:5;
>> y=x.^3+x-5;
>> plot(x,y),grid

SI TIENE SOLUCION

>> biseccion
ingrese la funcion: x.^3+x-5;
ingrese a: 1
ingrese b: 2
ingrese numero de iteraciones n: 3
f =Inline function:
f(x) = x.^3+x-5;
el resultado es: 1.625
c) >> syms x
>> x=-5:0.01:5;

>> y=x.^4+2*x.^2+1;

>> plot(x,y),grid

NO TIENE SOLUCION

d) >> syms x

>> x=-5:0.01:5;

>> y=exp(-x)+x.^2-6;

>> plot(x,y),grid

SI TIENE SOLUCION

>> biseccion

ingrese la funcion: exp(-x)+x.^2-6;

ingrese a: 2

ingrese b: 3

ingrese numero de iteraciones n: 5

f =Inline function:

f(x) = exp(-x)+x.^2-6;

el resultado es: 2.4063

e) >> syms x
>> x=-5:0.01:5;
>> y=log(x)+x.^2-5;
>> plot(x,y),grid

SI TIENE SOLUCION
>> biseccion
ingrese la funcion: log(x)+x.^2-5;
ingrese a: 2
ingrese b: 3
ingrese numero de iteraciones n: 4
f = Inline function:
f(x) = log(x)+x.^2-5;
el resultado es: 2.0625

f) >> syms x
>> x=-5:0.01:5;
>> y=sin((x/2))+7*x-6;
>> plot(x,y),grid

SI TIENE SOLUCION

>> biseccion
ingrese la funcion: sin((x/2))+7*x-6;
ingrese a: 0
ingrese b: 1
ingrese numero de iteraciones n: 3
f = Inline function:
f(x) = sin((x/2))+7*x-6;

el resultado es: 0.8750

g) >> syms x
>> x=-5:0.01:5;
>> y=log(x+4)-x.^3+5;
>> plot(x,y),grid

SI TIENE SOLUCION
>> biseccion
ingrese la funcion: log(x+4)-x.^3+5;
ingrese a: 1
ingrese b: 2
ingrese numero de iteraciones n: 3
f =Inline function:
f(x) = log(x+4)-x.^3+5;
el resultado es: 1.8750

h) >> syms x
>> x=-5:0.01:5;
>> y=(exp(2*x))/60+x.^2+1;
>> plot(x,y),grid

NO TIENE SOLUCION
I) >> syms x
>> x=-5:0.01:5;
>> y=cos(2*x)+7*x-1;
>> plot(x,y),grid

NO TIENE SOLUCION

h) >> syms x
>> x=-5:0.01:5;
>> y=exp(x-5)+x+4;
>> plot(x,y),grid

SI TIENE SOLUCION
>> biseccion
ingrese la funcion: exp(x-5)+x+4;
ingrese a: -4
ingrese b: -5
ingrese numero de iteraciones n: 3
f =Inline function:
f(x) = exp(x-5)+x+4;
el resultado es: -4.1250

También podría gustarte