% LEP 9-4 : Estimate rate-law parameters
%

Ks=30;
umax=0.5;
r1m=625;
r2m=610;
r3m=567.8;
r4m=558.1;
r1c=(Ks/umax)+(250/umax);
r2c=(Ks/umax)+(244/umax);
r3c=(Ks/umax)+(231/umax);
r4c=(Ks/umax)+(218/umax);
ssquare=(r1m-r1c)^2+(r2m-r2c)^2+(r3m-r3c)^2+(r4m-r4c)^2;
disp('The value of Sigma square is')
ssquare
x=[250,244,231,218];
y=[625,610,567.8,558.1];
sz=40;
Cs=linspace(210,260,100);
for i=1:100
  rate(i)=(Ks/umax)+(Cs(i)/umax);  
end
scatter(x,y,sz,'b','filled')
hold on
plot(Cs(1:100),rate(1:100),'Linewidth',2)
box on
axis([210 260 550 650])
leg=legend('data','fit');
leg.ItemTokenSize=[10,10];
xlabel('C_S')
ylabel('C_C*C_S/r_g')
grid on

%