Documentos de Académico
Documentos de Profesional
Documentos de Cultura
TAREA No.1
PROGRAMACION EN MATLAB
REALIZADO POR:
PROFESOR:
ING.MANUEL CALDERON SOLANO
03 DE ENERO DE 2017
VERANO 2016/2017
Teorema de biseccin
% Se define el error mximo aceptable
er = 0.00001;
if g(x_inf)*g(x_i) < 0
x_sup = x_i;
x_anterior = x_inf; % esto es para definir la convergencia sin
% almacenar los valores de x
elseif g(x_inf)*g(x_i) > 0
x_inf = x_i;
x_anterior = x_sup; % Idem al anterior
end
end
end
Regla Trapecio
function [I]=ReglaTrapecio(a,b,f,n)
syms x;
fa=subs(f,x,a);
fb=subs(f,x,b);
h=(b-a)/(n-1)
I=(h*(fa+fb))/2;
suma=0;
for i=1:n-1
xi=a+h*i;
suma=suma+subs(f,xi);
end
I=I+h*suma
end
Regla de Simpson
function [I]=ReglaSimpson(a,b,c,f)
syms x;
fa=subs(f,x,a)
fb=subs(f,x,b)
fc=subs(f,x,c)
I=((b-a)/6)*(fa+4*fc*fb)
end