function pemodelan_mikrobia_BAL_4_fujikawa clear clc global umax Nmax q0 N0 Ncoba tspan Nmin logNcoba umax=1.11675377; %jam^-1 Nmax=10^9.14; %CFU/ml N0=10^1.45; %CFU/ml Nmin=(1-1e-6)*10^1.45; Ncoba=[10^1.45;10^1.60;10^2.52;10^4.10;10^4.94;10^7.22;10^8.39;10^9.10;10^9.14]; logNcoba=log10(Ncoba) %y(1)= q %y(2)= N tspan=[0;2;4;6;8;12;16;20;24]; m=1; n=1; ytebak=[m;n]; [solution,sse,exitflag,output]=fminsearch(@func_RMSE,ytebak) end function RMSE=func_RMSE(g) global umax Nmax q0 N0 Ncoba tspan logNcoba [t y]=ode23(@func_ode,tspan,N0,[],g); Nhit=y; Nhit2=[log10(Nhit)]'; Nhit_inv=log10(Nhit) N02=[log10(Ncoba)]'; RMSE=(sum((N02-Nhit2).^2)./length(tspan)).^0.5 % huruf dalam tanda petik kedua menyatakan betuk kurva plot(t,N02,'bo',t,Nhit2,'r-') % huruf dalam tanda petik pertama menyatakan warna kurva %mencari R2 SStot=sum((logNcoba-mean(logNcoba)).^2); SSres=sum((logNcoba-Nhit_inv).^2); R2=1-(SSres./SStot) end function dN=func_ode(t,N,g) global umax Nmax Nmin m=g(1); n=g(2); dN=umax.*N.*(1-(N./Nmax).^g(1)).*(1-(Nmin./N).^g(2)); end