Está en la página 1de 7

# Minimización de funciones

%% Problema 1
% v=a+bT+cP+dPT

## P=[9000 10000 11000 9000 10000 11000 9000 10000 11000];

T=[700 700 700 800 800 800 900 900 900];

## v=[0.031980 0.028345 0.025360 0.037948 0.033827 0.030452 0.043675

0.039053 0.035270];
A=[9 sum(T) sum(P) sum(P.*T) ;
sum(T) sum(T.^2) sum(P.*T) sum(P.*T.^2);
sum(P) sum(T.*P) sum(P.^2) sum(P.^2.*T);
sum(P.*T) sum(P.*T.^2) sum(P.^2.*T) sum(P.^2.*T.^2)];

B=[sum(v);sum(v.*T);sum(v.*P);sum(v.*P.*T)];

pm=A\B;
a=pm(1); b=pm(2);c=pm(3);d=pm(4);
yv=a+b.*T+c.*P+d*P.*T;
scatter3(T,P,v,'filled')
hold on
scatter3(T,P,yv,'filled','r')

%Problema2
%f=aRe^b

## Re=[500 1000 1500 2000];

f=[0.032 0.0160 0.0107 0.008];

A=[4 sum(log(Re));
sum(log(Re)) sum(log(Re).^2)];

B=[sum(log(f)); sum(log(f).*log(Re))];
p=A\B;
a=exp(p(1));
b=p(2);
y=a*(Re).^b;
figure(1);plot(Re,y,'k',Re,f,'+r');

## %% Problema 83 reaccion hacia atras

% Determinar aplha,B con E/R=0

## close all; clear all;

T=[1000 2000 3000 4000 5000];
kb=[7.5E15 3.8E15 2.5E15 1.9E15 1.5E15];

A=[5 sum(log(T));
sum(log(T)) sum(log(T).*log(T))];

B=[sum(log(kb));sum(log(kb).*log(T))];

p=A\B;
Bp=exp(p(1));
alpha=p(2);
ykb=Bp.*T.^alpha*exp(0);
figure(1);plot(T,kb,'+r',T,ykb,'k');

## %% Problema 83 b reacción hacia adelante

%Determinar alpha, B, E/R

## T=[1000 2000 3000 4000 5000];

kf=[4.6E-7 5.9E4 2.5E8 1.4E10 1.5E11];

## A2=[5 sum(log(T)) sum(1./T);

sum(log(T)) sum(log(T).*log(T)) sum(log(T)./T);
sum(1./T) sum(log(T)./T) sum(1./(T.^2))];

B2=[sum(log(kf));sum(log(kf).*log(T));sum(log(kf)./T)];

p2=A2\B2;

Bf=exp(p2(1));
alpha=p2(2);
s=p2(3);
ykf=Bf.*T.^alpha.*exp(s./T);
figure(1);plot(T,kf,'*r',T,ykf,'k');
Generated by CamScanner from intsig.com
Generated by CamScanner from intsig.com
Generated by CamScanner from intsig.com
Generated by CamScanner from intsig.com
Generated by CamScanner from intsig.com