You are on page 1of 1

Lumped1L.

m
function dcdt=lumped1L(t,C,K,Kl)
Co=498.31;
V=0.25;
M=5000;
qm=0.0045488;
dcdt=-Kl*(C-((V/M*(Co-C))/((qm*K)-((V/M*(Co-C))*K))));

Lumped 1La.m
function E=lumped1La (kons)
K=kons(1);
Kl=kons(2);
Cdata=[498.31
415.31
441.18
407.62
410.14
407.62
400.32
405.15
402.72
412.7
412.7
393.37
397.97]';
[t C]=ode45(@lumped1L, [0 10 20 30 40 50 60 70 80 90 100 110 120],
498.31,[],kons(1),kons(2));
e=((Cdata-C').^2);
E=sum ((Cdata-C').^2)
t=[0 10 20 30 40 50 60 70 80 90 100 110 120];
plot(t,Cdata,'bo-', t,C,'rx-')
xlabel('waktu (s)');
ylabel('konsentrasi');
title('perbandingan Cdata & Cmodel');
legend('data','model');
pause (0.01);

Runlumped1L.m
clc
clear
kons=fminsearch(@lumped1La,[0.01 0.01]);
[t C]=ode45(@lumped1L,[0 10 20 30 40 50 60 70 80 90 100 110 120],
498.31,[],kons(1),kons(2));
C
K=kons(1)
Kl=kons(2)

You might also like