Professional Documents
Culture Documents
Ejercicios Del Lab.N°6 08-06-22
Ejercicios Del Lab.N°6 08-06-22
%NumIte = 15
%y1 = 2
%y2 = -0.500000000000000
%y3 = 2
%yy1 = -0.833333333333333
%yy2 = 0.416666666666667
%yyy1 = 0.178571428571429
%eva =
1
3
2
10
% ejercicio 4.m
% Interpolacion Polinomica
% Newton con diferencias finitas (h=dx=Cte)
% Agregar (7,9)
clc
clear all, format long
x=[1 3 5 7]'
y=[1 3 2 9]'
h=2
% Diferencias finita de 1er orden
y1=(y(2)-y(1))
y2=(y(3)-y(2))
y3=(y(4)-y(3))
% Diferencias finita de 2do orden
yy1=(y2-y1)
yy2=(y3-y2)
% Diferencias finita de 3er orden
yyy1=(yy2-yy1)
% Polinomio de Newton con diferencias divididas
syms z
p=y(1)+y1/h*(z-x(1))+yy1/(2*h^2)*(z-x(1))*(z-
x(2))+yyy1/(6*h^3)*(z-x(1))*(z-x(2))*(z-x(3))
pp=expand(p)
eva=subs(pp,x)
xi=4
yi=subs(p,xi)
%y1 = 2
%y2 = -1
%y3 = 7
%yy1 = -3
%yy2 = 8
%yyy1 = 11
%eva =
1
3
2
9
%xi = 4
%yi = 35/16