Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc, clear all, close all
- %Segunda Derivada. Ejercicio 1.
- syms x
- xi=input('Ingresar xi: ');
- h=input('Ingresar h: ');
- f=input('Función f(x): ');
- %Derivación. Términos
- fxi=subs(f,xi);
- fxih=subs(f,xi+h);
- fxihn=subs(f,xi-h);
- %Derivación hacia adelante
- segundader= vpa((1/h^2)*(fxih - 2*fxi + fxihn),5)
- %Para calcular error
- derivada=subs(diff(f,1),xi);
- error=vpa(abs(((derivada-segundader)/derivada)*100),4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement