You are on page 1of 4

INSTITUTO POLITÉCNICO NACIONAL

UNIDAD PROFESIONAL INTERDISCIPLINARIA DE BIOTECNOLOGÍA

Métodos numéricos

MÉTODO POLINOMIAL

Integrantes del equipo:


● Aviles Martínez Diana Guadalupe
● Quintero Vazquez Adriana
● Casillas Juarez Isaac Arturo
● Martínez Hernández Silvana Daniela

Grupo: 4LM1
2do parcial

Profesores:
● José Ignacio Flores Núñez
● Ángel Eduardo Zamora Suárez

18 Octubre 2023
CÓDIGO DE MATLAB
clc, clear, close all
% Regresión Polinomial
m=input("Introduce el numero de elementos")
for i=1:m
fprintf("Ingrese x(%g):",i)
x(i)=input("")
end
for k=1:m
fprintf("Ingrese y(%g):",k)
y(k)=input("")
end
n=1
for i=1:n+1
for k=1:n+1
A(i,k)=sum(x.^(i+k-2));
end
end
for i=1:n+1
B(i)=sum(y.*x.^(i-1));
end
X1=A^(-1)*B'
n=2
for i=1:n+1
for k=1:n+1
A2(i,k)=sum(x.^(i+k-2));
end
end
for i=1:n+1
B2(i)=sum(y.*x.^(i-1));
end
X2=A2^(-1)*B2'
subplot(2,2,1)
plot(x,y,'*')
hold on
d=min(x):0.01:max(x)
plot(d,d*X1(2)+X1(1))
subplot(2,2,2)
plot(x,y,'*')
hold on
d=min(x):0.01:max(x)
plot(d, d.^(2)*X2(3)+d*X2(2)+X2(1))
subplot(2,2,[3,4])
plot(x,y,'*')
hold on
plot(d, d.^(2)*X2(3)+d*X2(2)+X2(1))
hold on
plot(d,d*X1(2)+X1(1))
RESPUESTAS

m=6
Ingrese x(1):
x=0
Ingrese x(2):
x = 1×2
0 1
Ingrese x(3):
x = 1×3
0 1 2
Ingrese x(4):
x = 1×4
0 1 2 3
Ingrese x(5):
x = 1×5
0 1 2 3 4
Ingrese x(6):
x = 1×6
0 1 2 3 4 5
Ingrese y(1):
y = 2.2000
Ingrese y(2):
y = 1×2
2.2000 7.7000
Ingrese y(3):
y = 1×3
2.2000 7.7000 13.6000
Ingrese y(4):
y = 1×4
2.2000 7.7000 13.6000 27.2000
Ingrese y(5):
y = 1×5
2.2000 7.7000 13.6000 27.2000 40.9000
Ingrese y(6):
y = 1×6
2.2000 7.7000 13.6000 27.2000 40.9000 61.1000
n=1
X1 = 2×1
-3.6714
11.6486
n=2
X2 = 3×1
2.5607
2.3004
1.8696
d = 1×501
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700 0.0800
0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500 0.1600 0.1700
0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600
0.2700 0.2800 0.2900 0.3000 0.3100 0.3200 0.3300 0.3400 0.3500
0.3600 0.3700 0.3800 0.3900 0.4000 0.4100 0.4200 0.4300 0.4400
0.4500 0.4600 0.4700 0.4800 0.4900
d = 1×501
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700 0.0800
0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500 0.1600 0.1700
0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600
0.2700 0.2800 0.2900 0.3000 0.3100 0.3200 0.3300 0.3400 0.3500
0.3600 0.3700 0.3800 0.3900 0.4000 0.4100 0.4200 0.4300 0.4400
0.4500 0.4600 0.4700 0.4800 0.4900

GRÁFICAS

You might also like