Documentos de Académico
Documentos de Profesional
Documentos de Cultura
FACULTAD DE INGENIERÍA
ESCUELA PROFESIONAL DE INGENIERÍA CIVIL
APLICACIONES EN MATLAB
CUSCO-PERU
2018 - I
METODO DE BISECCION
Algoritmo en Matlab:
end
fprintf('\nEl resultado sera %11.7f\n',b);
ezplot(Fx);%graficamos la funcion
grid on;
Ejemplo:
1) Sea F(x)=x^2-4 Hallar la raíz utilizando el método de bisección y que el resultado sea
correcto en al menos 4 cifras decimales en el intervalo [-30;10].
Solucion:
Solución:
Tolerancia = 0.005
Ejemplo:
1) Hallar la raíz de F(x)= x^2-4 utilizando el método de Newton Raphson para X0=0.9 y que el
resultado sea correcto en al menos 4 cifras decimales.
Solución:
ingrese la funcion
f(x)=x^2-4
ingrese tolerancia:0.005
n xi error
1 0.90000000 100.000000
2 2.67222222 3.140772
3 2.08455186 0.345356
4 2.00171476 0.006862
2) Hallar la raíz de F(x)=senx+x-7 utilizando el método de Newton Raphson para X0=1 y que el
resultado sea correcto en al menos 4 cifras decimales.
solución:
ingrese la funcion
f(x)=sin(x)+x-7
ingrese tolerancia:0.005
n xi error
1 1.00000000 100.000000
2 4.34903674 3.585674
3 9.91175363 2.443798
4 -11.11055613 17.117159
5 4.24489320 3.647806
6 10.88514242 2.891234
7 7.63580734 1.612102
8 6.31055367 0.662081
9 6.64165636 0.007501
1) Hallar la raíz de F(x)= x^2-4 utilizando el método de Newton Raphson Modificado para X0=1
y que el resultado sea correcto en al menos 4 cifras decimales.
Solución:
n xk xk+1 error
Solución:
Ingrese funcion:
if (y4<1)
y4=0;
end
if (y4>1)
y4=0;
end
DERIVADA DE ORDEN N
Algoritmo en Matlab
%DERIVADA DE ORDEN SUPERIOR - Metodos Numericos Matlab
%Roy Franz Yucra Cardeña 014200660 J
format long
syms x
fx = input('Ingrese la función = ');
f = inline(fx);
n = input('Ingrese el orden de la derivada = ');
h = input('Ingrese el valor de h = ');
i=n;
x = input('Ingrese el valor de x = ');
disp('N° It. Derivada');
k = 0;
Fx = 0;
while i>=0
signo = mod(k,2);
if(signo>=1)
Fx =Fx-(factorial(n)/(factorial(n-k)*factorial(k)))* f(x+i*h);
i = i-1;
k=k+1;
Gx = Fx/(h^n);
else
Fx =Fx + (factorial(n)/(factorial(n-k)*factorial(k)))*
f(x+i*h);
i = i-1;
k=k+1;
Gx = Fx/(h^n);
end
fprintf('%d %10.6f \n',k,Gx);
end
EJEMPLO
MATRIZ INVERSA
Algoritmo en Matlab
%CALCULO DE MATRIZ INVERSA - Metodos Numericos Matlab
%Roy Franz Yucra Cardeña 014200660 J
function
[determinante,inversa,transpuesta,rangodeA,adjunta]=matrizresultante
A=input('ingrese la matriz:');
determinante=A,
inversa=inv(A),
transpuesta=A',
rangodeA=rank(A),
adjunta=(det(A))*A,
end
EJEMPLO
ECUACION MATRICIAL
Algoritmo en Matlab
% PROGRAMA PARA RESOLVER LA ECUACION MATRICIAL
function y = solucion (A,B)
clc,clear
A=input ('ingrese la matriz A = ')
B=input ('ingrese la matriz B = ')
y= inv(A)*B;
end
EJEMPLO
METODO DE TRAPECIO SIMPLE
Algoritmo en Matlab
%METODO DEL TRAPECIO SIMPLE
function [ y1,y2,e ] = trapesiosimple( fun,a,b )
f=inline(fun);
y1=(b-a)/2*(f(a)+f(b));
end
EJEMPLO
METODO DE TRAPECIO GENERALIZADO
Algoritmo en Matlab
% METODO DEL TRAPECIO GENERALIZADO
g=input('Ingrese la función: ');
b=input('Ingrese el limite superior: ');
a=input('Ingrese el limite inferior: ');
n=input('Ingrese la cantidad de divisones: ');
h=(b-a)/n; f=inline(g);
s=0
hold on
for i=1:n
s=h/2*(f(a+(i-1)*h)+f(a+(i)*h))+s;
EJEMPLO