function pemodelan_mikrobia_coli_2_umax2 clear clc global umax Nmax q0 N0 Ncoba tspan umax=0.695709639; %jam^-1 Nmax=10^7.98; %CFU/ml y0_awal=0; %0.005861 y0_akhir=10; N0=10^2.85; %CFU/ml Ncoba=[10^2.85;10^3.5;10^3.73;10^4.01;10^4.81;10^6.21;10^7.73;10^7.79;10^7.98]; %y(1)= q %y(2)= N tspan=[0;2;4;6;8;12;16;20;24]; [solution,sse,exitflag,output]=fminbnd(@func_RMSE,y0_awal,y0_akhir) end function RMSE=func_RMSE(y0) global umax Nmax q0 N0 Ncoba tspan q=[y0;N0] %y0=[X0 T0] [t y]=ode23(@func_ode,tspan,q); hasil = [t y]; Nhit=y(:,2) Nhit2=[log10(Nhit)]' N02=[log10(Ncoba)]' RMSE=(sum((N02-Nhit2).^2)./length(tspan)).^0.5 %mencari R2 SStot=sum((N02-mean(N02)).^2); SSres=sum((N02-Nhit2).^2); R2=1-(SSres./SStot) logNcoba=log10(Ncoba); logNhit2=log10(Nhit); % huruf dalam tanda petik kedua menyatakan betuk kurva %plot(t,N02,'bo',t,Nhit2,'r-') % huruf dalam tanda petik pertama menyatakan warna kurva plot(t,logNcoba,'bo',t,logNhit2,'r-') end function dy=func_ode(t,y) global umax Nmax q0 N0 q=y(1); N=y(2); dq=umax.*y(1); dN=(y(1)./(1+y(1))).*umax.*(1-(y(2)./Nmax)).*y(2); dy=[dq;dN]; end