Você está na página 1de 12

%PROGRAMA METODOS Y DETERMINACION DE CONSTANTES

clear all
clc
disp('Este programa calcula los valores de Km, Vmax y m de los metodos de
Lineweaver-Burk, Eadi-Hotstee y Agustinsson ')
N=input('Numero de Lecturas: ');
n=1;%grado de polinomio (n=1;Linealizacion)
disp('Introduce Valores de [S] y V0 ')
for i=1:N
fprintf('[S]%g=',i)
datosx(i)=input('');
fprintf('V0%g=',i)
datosy(i)=input('');
end
Dx=datosx';
Dy=datosy';
LBx=1./Dx;
LBy=1./Dy;
EHx=Dy./Dx;
EHy=Dy;
Ax=Dx;
Ay=Dx./Dy;
disp(' ')
disp('Tabla de Datos ')
disp(' [S] [V0] 1/S 1/V V/S S/V ')
disp([Dx,Dy,LBx,LBy,EHx,Ay])
%METODO DE LINEWEAVER-BURK
for i=1:n+1
for j=1:n+1
A(i,j)=sum(LBx.^(i+j-2));
end
end
for k=1:n+1
b(k,1)=sum(LBy.*(LBx.^(k-1)));
end
C=[A,b];
for j=1:n+1
for i=j+1:n+1
if C(j,i)>C(j,j)
TEMPO=C(i,:); C(i,:)=C(j,:); C(j,:)=TEMPO;
end
end
C(j,:)=C(j,:)/C(j,j);
for i=1:n+1
if i~=j
C(i,:)=C(i,:)-C(j,:)*C(i,j);
end
end
end
[p,q]=size(C);
for k=p:-1:1
g(1,(q-k))=C(k,q);
end
X=min(LBx):0.001:max(LBx);
Y=polyval(g,X);
hold on
grid on
subplot(2,2,1),plot(X,Y,'r')
hold on
grid on
axis('square')
subplot(2,2,1),plot(LBx,LBy,'b.')
title ('Grafica de Metodo de Lineweaver-Burk ');
xlabel (' 1/S ');
ylabel ('1/V ');
legend('Metodo de Lineweaver-Burk ')
g=g';
disp('Metodo de Lineweaver-Burk ')
disp(' 1/S 1/V ')
disp([LBx,LBy])
disp('y= ')
for t=n+1:-1:1
if t>1
fprintf('%gx ',g(t-1,1));
else
fprintf('%g \n',g(t+1,1));
end
end
R=(N*sum(LBx.*LBy)-sum(LBx).*sum(LBy))/(sqrt(N*sum(LBx.^2)-
(sum(LBx)).^2)*(sqrt(N*sum(LBy.^2)-(sum(LBy)).^2)));
R2=R^2;
fprintf(' Coeficiente de Correlacion: R^2=%g \n',R2);
LBVmax=1/polyval(g',0)
LBKm=-1/roots(g')
LBm=LBKm/LBVmax
%METODO DE EADI-HOTSTEE
for i=1:n+1
for j=1:n+1
A(i,j)=sum(EHx.^(i+j-2));
end
end
for k=1:n+1
b(k,1)=sum(EHy.*(EHx.^(k-1)));
end
C=[A,b];
for j=1:n+1
for i=j+1:n+1
if C(j,i)>C(j,j)
TEMPO=C(i,:); C(i,:)=C(j,:); C(j,:)=TEMPO;
end
end
C(j,:)=C(j,:)/C(j,j);
for i=1:n+1
if i~=j
C(i,:)=C(i,:)-C(j,:)*C(i,j);
end
end
end
[p,q]=size(C);
for k=p:-1:1
gEH(1,(q-k))=C(k,q);
end
XEH=min(EHx):0.001:max(EHx);
YEH=polyval(gEH,XEH);
hold on
grid on
subplot(2,2,2),plot(XEH,YEH,'g')
hold on
grid on
subplot(2,2,2),plot(EHx,EHy,'b.')
title ('Grafica de Metodo de Eadi-Hotstee');
xlabel (' V/S ');
ylabel ('V ');
legend('Metodo de Eadi-Hotstee')
gEH=gEH';
disp(' ')
disp(' Metodo de Eadi-Hotstee')
disp(' V/S V ')
disp([EHx,EHy])
disp('y= ')
for t=n+1:-1:1
if t>1
fprintf('%gx ',gEH(t-1,1));
else
fprintf('%g \n',gEH(t+1,1));
end
end
R=(N*sum(EHx.*EHy)-sum(EHx).*sum(EHy))/(sqrt(N*sum(EHx.^2)-
(sum(EHx)).^2)*(sqrt(N*sum(EHy.^2)-(sum(EHy)).^2)));
R2=R^2;
fprintf(' Coeficiente de Correlacion: R^2=%g \n',R2);
EHVmax=polyval(gEH,0)
EHKm=EHVmax/roots(gEH)
EHm=-EHKm
%METODO DE AGUSTINSSON
for i=1:n+1
for j=1:n+1
A(i,j)=sum(Ax.^(i+j-2));
end
end
for k=1:n+1
b(k,1)=sum(Ay.*(Ax.^(k-1)));
end
C=[A,b];
for j=1:n+1
for i=j+1:n+1
if C(j,i)>C(j,j)
TEMPO=C(i,:); C(i,:)=C(j,:); C(j,:)=TEMPO;
end
end
C(j,:)=C(j,:)/C(j,j);
for i=1:n+1
if i~=j
C(i,:)=C(i,:)-C(j,:)*C(i,j);
end
end
end
[p,q]=size(C);
for k=p:-1:1
gA(1,(q-k))=C(k,q);
end
XA=min(Ax):0.001:max(Ax);
YA=polyval(gA,XA);
hold on
grid on
subplot(2,2,3),plot(XA,YA,'m')
hold on
grid on
subplot(2,2,3),plot(Ax,Ay,'b.')
title ('Grafica de Metodo de Agustinsson');
xlabel (' S ');
ylabel ('S/V ');
legend('Metodo de Agustinsson' )
gA=gA';
disp(' ')
disp(' Metodo de Agustinsson')
disp(' S S/V ')
disp([Ax,Ay])
disp('y= ')
for t=n+1:-1:1
if t>1
fprintf('%gx ',gA(t-1,1));
else
fprintf('%g \n',gA(t+1,1));
end
end
R=(N*sum(Ax.*Ay)-sum(Ax).*sum(Ay))/(sqrt(N*sum(Ax.^2)-
(sum(Ax)).^2)*(sqrt(N*sum(Ay.^2)-(sum(Ay)).^2)));
R2=R^2;
fprintf(' Coeficiente de Correlacion: R^2=%g \n',R2);
AKm=-roots(gA')
AVmax=AKm/polyval(gA',0)
Am=1/AVmax
disp('Regrenzi R Version 1.0 (R2010) 32 bit(win32) 26/Oct/2010 License
Number 10960 Copyright 1999-2010 The Wirwin Inc protected by the U.S. and
international patents.')

%Metodo de minimos cuadrados Regresion Lineal.


clear all
clc
disp('Este programa calcula los valores de Km, Vmax y m de los metodos de
Lineweaver-Burk, Eadi-Hotstee y Agustinsson ')
N=input('Numero de Lecturas: ');
n=1;%grado de polinomio (n=1;Linealizacion)
disp('Introduce Valores de [S] y V0 ')
for i=1:N
fprintf('[S]%g=',i)
datosx(i)=input('');
fprintf('V0%g=',i)
datosy(i)=input('');
end
Dx=datosx';
Dy=datosy';
LBx=1./Dx;
LBy=1./Dy;
EHx=Dy./Dx;
EHy=Dy;
Ax=Dx;
Ay=Dx./Dy;
disp(' ')
disp('Tabla de Datos ')
disp(' [S] [V0] 1/S 1/V V/S S/V ')
disp([Dx,Dy,LBx,LBy,EHx,Ay])
%METODO DE LINEWEAVER-BURK
for i=1:n+1
for j=1:n+1
A(i,j)=sum(LBx.^(i+j-2));
end
end
for k=1:n+1
b(k,1)=sum(LBy.*(LBx.^(k-1)));
end
C=[A,b];
for j=1:n+1
for i=j+1:n+1
if C(j,i)>C(j,j)
TEMPO=C(i,:); C(i,:)=C(j,:); C(j,:)=TEMPO;
end
end
C(j,:)=C(j,:)/C(j,j);
for i=1:n+1
if i~=j
C(i,:)=C(i,:)-C(j,:)*C(i,j);
end
end
end
[p,q]=size(C);
for k=p:-1:1
g(1,(q-k))=C(k,q);
end
X=min(LBx):0.001:max(LBx);
Y=polyval(g,X);
hold on
grid on
subplot(2,2,1),plot(X,Y,'r')
hold on
grid on
axis('square')
subplot(2,2,1),plot(LBx,LBy,'b.')
title ('Grafica de Metodo de Lineweaver-Burk ');
xlabel (' 1/S ');
ylabel ('1/V ');
legend('Metodo de Lineweaver-Burk ')
g=g';
disp('Metodo de Lineweaver-Burk ')
disp(' 1/S 1/V ')
disp([LBx,LBy])
disp('y= ')
for t=n+1:-1:1
if t>1
fprintf('%gx ',g(t-1,1));
else
fprintf('%g \n',g(t+1,1));
end
end
R=(N*sum(LBx.*LBy)-sum(LBx).*sum(LBy))/(sqrt(N*sum(LBx.^2)-
(sum(LBx)).^2)*(sqrt(N*sum(LBy.^2)-(sum(LBy)).^2)));
R2=R^2;
fprintf(' Coeficiente de Correlacion: R^2=%g \n',R2);
LBVmax=1/polyval(g',0)
LBKm=-1/roots(g')
LBm=LBKm/LBVmax
%METODO DE EADIE-HOFSTEE
for i=1:n+1
for j=1:n+1
A(i,j)=sum(EHx.^(i+j-2));
end
end
for k=1:n+1
b(k,1)=sum(EHy.*(EHx.^(k-1)));
end
C=[A,b];
for j=1:n+1
for i=j+1:n+1
if C(j,i)>C(j,j)
TEMPO=C(i,:); C(i,:)=C(j,:); C(j,:)=TEMPO;
end
end
C(j,:)=C(j,:)/C(j,j);
for i=1:n+1
if i~=j
C(i,:)=C(i,:)-C(j,:)*C(i,j);
end
end
end
[p,q]=size(C);
for k=p:-1:1
gEH(1,(q-k))=C(k,q);
end
XEH=min(EHx):0.001:max(EHx);
YEH=polyval(gEH,XEH);
hold on
grid on
subplot(2,2,2),plot(XEH,YEH,'g')
hold on
grid on
subplot(2,2,2),plot(EHx,EHy,'b.')
title ('Grafica de Metodo de Eadie-Hofstee');
xlabel (' V/S ');
ylabel ('V ');
legend('Metodo de Eadie-Hofstee')
gEH=gEH';
disp(' ')
disp(' Metodo de Eadie-Hofstee')
disp(' V/S V ')
disp([EHx,EHy])
disp('y= ')
for t=n+1:-1:1
if t>1
fprintf('%gx ',gEH(t-1,1));
else
fprintf('%g \n',gEH(t+1,1));
end
end
R=(N*sum(EHx.*EHy)-sum(EHx).*sum(EHy))/(sqrt(N*sum(EHx.^2)-
(sum(EHx)).^2)*(sqrt(N*sum(EHy.^2)-(sum(EHy)).^2)));
R2=R^2;
fprintf(' Coeficiente de Correlacion: R^2=%g \n',R2);
EHVmax=polyval(gEH,0)
EHKm=EHVmax/roots(gEH)
EHm=-EHKm
%METODO DE AGUSTINSSON
for i=1:n+1
for j=1:n+1
A(i,j)=sum(Ax.^(i+j-2));
end
end
for k=1:n+1
b(k,1)=sum(Ay.*(Ax.^(k-1)));
end
C=[A,b];
for j=1:n+1
for i=j+1:n+1
if C(j,i)>C(j,j)
TEMPO=C(i,:); C(i,:)=C(j,:); C(j,:)=TEMPO;
end
end
C(j,:)=C(j,:)/C(j,j);
for i=1:n+1
if i~=j
C(i,:)=C(i,:)-C(j,:)*C(i,j);
end
end
end
[p,q]=size(C);
for k=p:-1:1
gA(1,(q-k))=C(k,q);
end
XA=min(Ax):0.001:max(Ax);
YA=polyval(gA,XA);
hold on
grid on
subplot(2,2,3),plot(XA,YA,'m')
hold on
grid on
subplot(2,2,3),plot(Ax,Ay,'b.')
title ('Grafica de Metodo de Agustinsson');
xlabel (' S ');
ylabel ('S/V ');
legend('Metodo de Agustinsson' )
gA=gA';
disp(' ')
disp(' Metodo de Agustinsson')
disp(' S S/V ')
disp([Ax,Ay])
disp('y= ')
for t=n+1:-1:1
if t>1
fprintf('%gx ',gA(t-1,1));
else
fprintf('%g \n',gA(t+1,1));
end
end
R=(N*sum(Ax.*Ay)-sum(Ax).*sum(Ay))/(sqrt(N*sum(Ax.^2)-
(sum(Ax)).^2)*(sqrt(N*sum(Ay.^2)-(sum(Ay)).^2)));
R2=R^2;
fprintf(' Coeficiente de Correlacion: R^2=%g \n',R2);
AKm=-roots(gA')
AVmax=AKm/polyval(gA',0)
Am=1/AVmax
disp('Regrenzi R Version 1.0 (R2010) 32 bit(win32) 26/Oct/2010 License
Number 10960 Copyright 1999-2010 The Wirwin Inc protected by the U.S. and
international patents.')

Você também pode gostar