Solucionario de Pc2 - Mayhua
Solucionario de Pc2 - Mayhua
Solucionario de Pc2 - Mayhua
𝐜 = 𝟏𝟐 × (𝟏 − 𝒆−𝟎.𝟎𝟒𝒕 ) + 𝟓 × 𝒆−𝟎.𝟎𝟒𝒕
function z =grafica(n,m)
x=n:1:m;
y= 12*(1-exp(-0.04*x))+5*exp(-0.04*x);
plot(x,y);
grid on;
title('f(x)');
z=[x' y'];
zoom on
end
Como el 85% de cent es 10.2 se busca con zoom en la gráfica el tiempo
requerido.
Zoom on
Por lo tanto, es: t= 33.953s
Para comprobar:
[f] = fun(33.953)
f=
10.2000
er1=100;
m0=100;
for n=0:100
m=(a+b)/2;
Fa=12*(1-exp(-0.04*a))+5*exp(-0.04*a);
Fm=12*(1-exp(-0.04*m))+5*exp(-0.04*m);
if Fa*Fm<0
b=m;
else
a=m;
end
er1=(abs(m-m0)/m)*100;
m0=m;
if er1<=er2
break;
end
end
Respuesta:
n=
m=
- 13.500
function mbisec(f,a,b,tol)
fprintf('It. a b Xr f(a) f(xr)
ea\n');
disp('--------------------------------------------------------------
-------')
f=inline(f);
i=1;
ea(1)=100;
xr(i)=(a+b)/2;
while abs(ea(i)) >= tol
fprintf('%2d\t %11.7f\t %11.7f\t %11.7f\t %11.7f\t %11.7f\t
%11.7f\n',...
i,a(i),b(i),xr(i),f(a(i)),f(xr(i)),ea(i));
if f(a(i))*f(xr(i))<0
a(i+1)=a(i);
b(i+1)=xr(i);
else
b(i+1)=b(i);
a(i+1)=xr(i);
end
xr(i+1)=(a(i+1)+b(i+1))/2;
ea(i+1)=abs((xr(i+1)-xr(i))/(xr(i+1))*100);
i=i+1;
end
end
Respuesta:
Donde M=masa (mg), t1=tiempo inicial (min), t2=tiempo final (min), Q(t)= caudal
(m3/min), c(t)= concentración (mg/m3). Las siguientes representaciones funcionales
definen las variaciones temporales en el flujo y concentración:
𝟖
𝐌 = ∮ (𝟗 + 𝟒𝐜𝐨𝐬𝟐 (𝟎. 𝟒𝒕))(𝟓𝐞−𝟎.𝟓𝒕 + 𝟐𝒆𝟎.𝟏𝟓𝒕 )𝐝𝐭
𝟐
(𝒃 − 𝒂)𝒕 + (𝒃 + 𝒂)
𝒕=
𝟐
(𝟖 − 𝟐)𝒙 + (𝟖 + 𝟐)
𝒕=
𝟐
𝒕 = 𝟑𝒙 + 𝟓
𝟖−𝟐
𝒅𝒕 = 𝒅𝒙
𝟐
𝒅𝒕 = 𝟑𝒅𝒙
%Cuadrantura
c0=0.3478548;
c1=0.6521452;
c2=0.6521452;
c3=0.3478548;
x0=-0.861136312;
x1=-0.339981044;
x2=0.339981044;
x3=0.861136312;
fx0=3*((9+4*(cos(0.4*(3*x0+5)))^2)*(5*exp(-0.5*(3*x0+5))+2*exp(0.15*(3*x0+5))));
fx1=3*((9+4*(cos(0.4*(3*x1+5)))^2)*(5*exp(-0.5*(3*x1+5))+2*exp(0.15*(3*x1+5))));
fx2=3*((9+4*(cos(0.4*(3*x2+5)))^2)*(5*exp(-0.5*(3*x2+5))+2*exp(0.15*(3*x2+5))));
fx3=3*((9+4*(cos(0.4*(3*x3+5)))^2)*(5*exp(-0.5*(3*x3+5))+2*exp(0.15*(3*x3+5))));
I=c0*fx0+c1*fx1+c2*fx2+c3*fx3
fprintf('integral aprox= %7.7f',I);
Respuesta:
I = 322.3562
integral aprox= 322.3561682
Graficar:
%grafica trapecio
x=[2 3 4 5 6 7 8];
y=[49.6652 40.5038 38.9030 45.0171 57.7540 73.6286 87.4218];
stem(x,y)
hold on
plot(x,y)
Usamos Simpson 1/3 tramo 1 (2,3,4) y trapecio múltiple tramo 2 (4,5,6,7,8)
%Simpson 1/3
n1=2;
h1=(x(3)-x(1))/n1;
I1=(f(1)+4*f(2)+f(3))*h1/3
%Trapecio multiple
n2=4;
h2=(x(7)-x(3))/n2;
I2=(f(3)+2*(f(4)+f(5)+f(6))+f(7)*h2)/2
I=I1+I2
RESPUESTA:
I = 323.0899
c) Aplicar el método Romberg O(h4)
a=0;
b=8;
h=(b-a)/8;
x=a:h:b;
f=[91 66.3831 49.6652 40.5038 38.9030 45.0171 57.7540 73.6286
87.4218];
z=[x' f']
%programando
n=1;
h1=(b-a)/n;
I1=(f(1)+f(7))*h1/2;
%
n2=2;
h2=(b-a)/n2;
I2=(f(1)+2*f(4)+f(7))*h2/2;
%
n3=4;
h3=(b-a)/n3;
I3=(f(1)+2*(f(3)+f(5)+f(7)))*h3/2;
%
n4=8;
h4=(b-a)/n4;
I4=(f(1)+2*(f(2)+f(3)+f(4)+f(5)+f(6)+f(7)))*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
I41 = 328.1444
x 0 2 4 7 10 12
y 20 20 12 7 6 6
a = [0 2 4 7 10 12];
b = [20 20 12 7 6 6];
AA = 0 : 0.1 : 12;
BB = spline( a , b , AA );
plot(a,b,'o',AA,BB)
grid on
Ao = 1.5;
Bo = spline( a , b , Ao )
RESPUESTA:
Bo = 21.3344
RESPUESTA:
Cuando x=1.5 y va ser y=21.3344
AJUSTE POLINOMIAL
%Newton
x = [0 2 4 7 10 12];
y = [20 20 12 7 6 6];
p=polyfit(x,y,3);
ycalc=polyval(p,x);
%con curvas
m=length(x);
x1=linspace(x(1),x(m),100);
ycalc1=polyval(p,x1);
%coeficiente R
nelem=length(y);
yp=sum(y)/nelem;
N=sum((ycalc-yp).^2);
D=sum((y-yp).^2);
r=N/D;
%evaluar
Rendi=polyval(p,1.5)
%graficar
plot(x,y,'o',x1, ycalc1,'--')
title(sprintf('Grado del polinomio %d',m-1));
xlabel(sprintf('R: %7.7f',r));
grid minor
RESPUESTA:
Rendi = 18.6575
RESPUESTA:
Cuando x=1.5 y va ser y o rendi= 18.6575