Subido por christian ricaldi

CHRISTIAN ALBERTO RICALDI PUNTOS EXTRAS PC2

Anuncio
```PUNTOS EXTRAS PC 2
ALUMNO : Ricaldi Suasnabar Christian
CODIGO : U201621900
PROBLEMA 1
METODO DE ROMBERG :
x=[0 2 4 6 8 10 12 14 16 18 20];
y=[0 1.8 2 4 4 6 4 3.6 3.4 2.8 0];
x1=linspace(0,20,9);
p=polyfit(x,y,10);
ycalc=polyval(p,x1);
z=[x1' ycalc']
z=
0 -0.0000
2.5000 -0.8636
5.0000 4.1129
7.5000 3.5856
10.0000 6.0000
12.5000 3.4381
15.0000 4.2926
17.5000 1.1042
20.0000 -0.0000
a=0;
b=20;
h=(b-a)/8;
%programando
n=1;
h1=(b-a)/n;
x1=a:h1:b;
I1=(f(1)+f(9))*h1/2;
%
n2=2;
h2=(b-a)/n2;
x2=a:h2:b;
I2=(f(1)+2*f(5)+f(9))*h2/2;
%
n3=4;
h3=(b-a)/n3;
x3=a:h3:b;
I3=(f(1)+2*(f(3)+f(5)+f(7))+f(9))*h3/2;
%
n4=8;
h4=(b-a)/n4;
x4=a:h4:b;
I4=(f(1)+2*(f(2)+f(3)+f(4)+f(5)+f(6)+f(7)+f(8))+f(9))*h4/2;
% NIVEL 1
I21=(4*I2-I1)/3;
I32=(4*I3-I2)/3;
I43=(4*I4-I3)/3;
% NIVEL 2
I31=(16*I32-I21)/15;
I42=(16*I43-I32)/15;
% NIVEL 3
I41=(64*I42-I31)/63;
fprintf('el valor de la integral es : %7.7f \n', I41);
el valor de la integral es: 45.9024449
METODO POR SEGEMENTOS DESIGUALES
x=[0 2 4 6 8 10 12 14 16 18 20];
f=[0 1.8 2 4 4 6 4 3.6 3.4 2.8 0];
%grafica
stem (x,f)
hold on
plot(x,f)
%s3/8
n1=3;
h1=(x(4)-x(1))/n1;
s1=3*(f(1)+3*f(2)+3*f(3)+f(4))*h1/8;
%s3/8
n2=3;
h2=(x(7)-x(4))/n2;
s2=3*(f(4)+3*f(5)+3*f(6)+f(7))*h2/8;
%s3/8
n3=3;
h3=(x(10)-x(7))/n3;
s3=3*(f(7)+3*f(8)+3*f(9)+f(10))*h3/8;
%ts
n4=1;
h4=(x(11)-x(10))/n4;
s4=(f(10)+f(11))*h4/2;
I=s1+s2+s3+s4;
fprintf('el valor de la integral es : %7.7f\n',I);
el valor de la integral es : 63.7000000
:
x=[0 2 4 6 8 10 12 14 16 18 20];
y=[0 1.8 2 4 4 6 4 3.6 3.4 2.8 0];
p=polyfit(x,y,10)
x1=linspace(0,20,6);
ycalc=polyval(p,x1);
z=[x1' ycalc']
p = -0.0000 0.0000 -0.0006 0.0156 -0.2316 2.1790 -12.8610 45.4340 -85.9344 65.5502
-0.0000
z=
N=6
%coeficientes
c0=0.1713245;
c1=0.3607616;
c2=0.4679139;
c3=0.4679139;
c4=0.3607616;
c5=0.1713245;
%Arguemntos
x0=-0.932469514;
x1=-0.661209386;
x2=-0.238619186;
x3=0.238619186;
x4=0.661209386;
x5=0.932469514;
%Ft
0
-0.0000
4.0000
2.0000
8.0000
4.0000
12.0000
4.0000
16.0000
3.4000
20.0000
-0.0000
y0=10*x0+10;
y1=10*x1+10;
y2=10*x2+10;
y3=10*x3+10;
y4=10*x4+10;
y5=10*x5+10;
%Fx
fx0=10*(-0.0006*y0^8
+0.0156*y0^7
-0.2316*y0^6
+2.1790*y0^5 -12.8610*y0^4
+45.4340*y0^3 -85.9344*y0^2
+65.5502*y0);
fx1=10*(-0.0006*y1^8
+0.0156*y1^7
-0.2316*y1^6
+2.1790*y1^5 -12.8610*y1^4
+45.4340*y1^3 -85.9344*y1^2
+65.5502*y1);
fx2=10*(-0.0006*y2^8
+0.0156*y2^7
-0.2316*y2^6
+2.1790*y2^5 -12.8610*y2^4
+45.4340*y2^3 -85.9344*y2^2
+65.5502*y2);
fx3=10*(-0.0006*y3^8
+0.0156*y3^7
-0.2316*y3^6
+2.1790*y3^5 -12.8610*y3^4
+45.4340*y3^3 -85.9344*y3^2
+65.5502*y3);
fx4=10*(-0.0006*y4^8
+0.0156*y4^7
-0.2316*y4^6
+2.1790*y4^5 -12.8610*y4^4
+45.4340*y4^3 -85.9344*y4^2
+65.5502*y4);
fx5=10*(-0.0006*y5^8
+0.0156*y5^7
-0.2316*y5^6
+2.1790*y5^5 -12.8610*y5^4
+45.4340*y5^3 -85.9344*y5^2
+65.5502*y5);
I=c0*fx0+c1*fx1+c2*fx2+c3*fx3+c4*fx4+c5*fx5
I= 74.350000000
PROBLEMA 2:
METODO DE ROMBERG
x=[0.02 0.05 0.1 0.15 0.2 0.25];
f=[40 37.5 43 52 60 55];
%interpolando
x1=linspace(0.02,0.25,9);
p=polyfit(x,f,5);
ycal=polyval(p,x1);
z=[x1' ycal'];
z=
0.0200 40.0000
0.0488 37.4745
0.0775 39.7264
0.1063 44.0349
0.1350 49.1858
0.1638 54.5490
0.1925 59.1562
0.2213 60.7776
0.2500 55.0000
a=0.02;
b=0.25;
h=(b-a)/8;
%programando
n=1;
h1=(b-a)/n;
x1=a:h1:b;
I1=(ycal(1)+ycal(9))*h1/2;
%
n2=2;
h2=(b-a)/n2;
x2=a:h2:b;
I2=(ycal(1)+2*ycal(5)+ycal(9))*h2/2;
%
n3=4;
h3=(b-a)/n3;
x3=a:h3:b;
I3=(ycal(1)+2*(ycal(3)+ycal(5)+ycal(7))+ycal(9))*h3/2;
%
n4=8;
h4=(b-a)/n4;
x4=a:h4:b;
I4=(ycal(1)+2*(ycal(2)+ycal(3)+ycal(4)+ycal(5)+ycal(6)+ycal(7)+ycal(8))+y
cal(9))*h4/2;
%NIVEL 1
I21=(4*I2-I1)/3;
I32=(4*I3-I2)/3;
I43=(4*I4-I3)/3;
%NIVEL 2
I31=(16*I32-I21)/15;
I42=(16*I43-I32)/15;
%NIVEL 3
I41=(64*I42-I31)/63;
fprintf('el valor de la integrales: %7.7f \n', I41);
el valor de la integral es : 11.2942081
METODO POR SEGEMENTOS DESIGUALES
x=[0.02 0.05 0.1 0.15 0.2 0.25];
f=[40 37.5 43 52 60 55];
%graficando
stem (x,f)
hold on
plot(x,f)
%ts
n1=1;
h1=(x(2)-x(1))/n2;
s1=(f(1)+f(2))*h2/2;
%3/8
n2=3;
h2=(x(5)-x(2))/n1;
s2=3*(f(2)+3*f(3)+3*f(4)+f(5))*h1/8;
%ts
n3=1;
h3=(x(6)-x(5))/n2;
s3=(f(5)+f(6))*h2/2;
I=s1+s2+s3;
fprintf('el valor de la integral es :%7.7f \n',I);
el valor de la integral es :15.8718750
N=6puntos
x=[0.02 0.05 0.1 0.15 0.2 0.25];
f=[40 37.5 43 52 60 55];
%interpolando
x1=linspace(0.02,0.25,6);
p=polyfit(x,f,5);
ycal=polyval(p,x1);
p =
1.0e+05 *
-3.9143
2.4357
-0.6418
0.0913
-0.0052
0.0005
%coeficientes
c0=0.1713245;
c1=0.3607616;
c2=0.4679139;
c3=0.4679139;
c4=0.3607616;
c5=0.1713245;
%arguemntos
x0=-0.932469514;
x1=-0.661209386;
x2=-0.238619186;
x3=0.238619186;
x4=0.661209386;
x5=0.932469514;
%Ft
y0=0.115*x0+0.135
y1=0.115*x1+0.135
y2=0.115*x2+0.135
y3=0.115*x3+0.135
y4=0.115*x4+0.135
y5=0.115*x5+0.135
%Fx
fx0=0.115*(-3.9143*y0^5 + 2.4357*y0^4
0.0052*y0 + 0.0005)*10^5
fx1=0.115*(-3.9143*y1^5 + 2.4357*y1^4
0.0052*y1 + 0.0005)*10^5
fx2=0.115*(-3.9143*y2^5 + 2.4357*y2^4
0.0052*y2 + 0.0005)*10^5
fx3=0.115*(-3.9143*y3^5 + 2.4357*y3^4
0.0052*y3 + 0.0005)*10^5
fx4=0.115*(-3.9143*y4^5 + 2.4357*y4^4
0.0052*y4 + 0.0005)*10^5
fx5=0.115*(-3.9143*y5^5 + 2.4357*y5^4
0.0052*y5 + 0.0005)*10^5
-0.6418*y0^3+
0.0913*y0^2
-
-0.6418*y1^3+
0.0913*y1^2
-
-0.6418*y2^3+
0.0913*y2^2
-
-0.6418*y3^3+
-
-0.6418*y4^3+
0.0913*y4^2
-
-0.6418*y5^3+
0.0913*y5^2
-
I=c0*fx0+c1*fx1+c2*fx2+c3*fx3+c4*fx4+c5*fx5
fprintf('el valor de la integral es :%7.7f\n',I);
el valor de la integral es :11.8533091
0.0913*y3^2
```