MONODOV MODEL

Podaci za rast E. coly

data=
{{0,       2.4  },
{30,   5.4          },  
{50,     8.7        }, 
{70,        12.5  },
{100,        19.2   },
{130,      30.3     },
{150,       40.5  },
{170,       53.3  },
{200,       72.2  },
{230,     88.1  },
{250,      94.7 },
{300,     104.2 },
{350,     108.3 },
{370,     108.3 },
{400,      108.3 }};

pod=ListPlot[data,Frame->{True,True,False,False},FrameLabel->{"Vrijeme (sati)","Veličina populacije"},FrameStyle->{Directive[12,Thickness[0.004]],Directive[12,Thickness[0.004]]},RotateLabel->True, PlotStyle->{PointSize[0.015],RGBColor[1,0,0]}]

lpod=ListLogPlot[data,Frame->{True,True,False,False},FrameLabel->{"Vrijeme (dani)","Veličina populacije"},FrameStyle->{Directive[12,Thickness[0.004]],Directive[12,Thickness[0.004]]},RotateLabel->True,PlotStyle->{PointSize[0.015],RGBColor[1,0,0]}]

Graf P(t), S(t)

Slika 4-1a  	4-1b

Clear[v,k,y,p,s];
v=1;
k=1;
y=0.99;
xend=12;
eq=NDSolve[{p'[x]==v s[x]/(k+s[x])p[x]/y, s'[x]==-v s[x]/(k+s[x])p[x],p[0]==0.02,s[0]==2},{p[x],s[x]},{x,0,xend}];
p[x_]=N[p[x]]/.eq;
s[x_]=N[s[x]]/.eq;
g1=Plot[p[x],{x,0,xend}, PlotRange->{0,2.1},AspectRatio->0.4,FrameLabel->{"Vrijeme","P(t)"},Frame->{True,True,False,False},FrameStyle->{Directive[12,Thickness[0.004]],Directive[12,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.005},{Green,Thickness->0.005}}]
g2=Plot[s[x],{x,0,xend},PlotRange->{0,2.1},AspectRatio->0.4,FrameLabel->{"Vrijeme","S(t)"},Frame->{True,True,False,False},FrameStyle->{Directive[12,Thickness[0.004]],Directive[12,Thickness[0.004]]},PlotStyle->{{Red,Thickness->0.005},{Green,Thickness->0.005}}]

METODA NAJMANJIH KVADRATA

MNK i logistička krivulja

pfun2=ParametricNDSolveValue[{p'[x]==pv(pc-p[x])/(pk+pc-p[x])p[x],p[0]==py0},p,{x,0,400},{pv,pk,pc,py0}];

fit=FindFit[data,pfun2[pv,pk,pc,py0][t],{{pv,0.9},{pk,4200},{pc,108},{py0,2.4}},t,PrecisionGoal->20,MaxIterations->30000]

y[x_,v_,c_,k_,y0_]:= Module[{},With[{pv=v,pc=c,pk=k,py0=y0},NDSolve[{p'[x]==pv(pc-p[x])/(pk+pc-p[x])p[x],p[0]==py0},p[x],{x,0,400}]]]

f[x_,v_,c_,k_,y0_]:=p[x]/.y[x,v,c,k,y0]

eq=y[x,1,2,1,0.02]

gg[x_]=p[x]

Evaluate[gg[1]]

Clear[f]

Slika 4-2

v=0.25;
c=108;
k=1100;
y0=2.4;


v=0.9;
c=108;
k=4200;
y0=2.4;

v=0.05474709558339312;
c=108.60466341429941;
k=205.01379131972962;
y0=3.2113667624308144;

g[x_]=f[x,v,c,k,y0];
s1=Plot[g[t],{t,0,400},PlotRange->{0,110},FrameLabel->{"Vrijeme (min)","P(t)"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.005},{Green,Thickness->0.005}}];
Show[s1,pod]

g[]

g[{0,10,20,30,40,50,100,200,300,400}]

ffun=ParametricNDSolve[{p'[x]==pv(pc-p[x])/(pk+pc-p[x])p[x],p[0]==py0},p[x],{x,0,400},{pv,pc,pk,py0}]

ffun[pv,pc,pk,py0][x]

par=FindFit[data,ffun[xx,pv,pc,pk,py0],{{pv,0.9},{pc,108},{pk,4200},{py0,2.4}},xx]

par=FindFit[data,f[x,pv,108,pk,2.4],{{pv,0.3},{pk,2}},x]

par=FindFit[data,f[x,pv,pc,pk,py0],{{pv,0.3},{pc,100},{pk,2},py0},x]

gg[x_]=p[x]/.ff[x,1,2,1,0.02]

gg[1]+gg[2]

Plot[gg[x],{x,0,10}]

z[x_]=N[y[x]]/.eq

z[1]

NDSolve[{y'[x]==(((2-y[x]) y[x])/(3-y[x])),y[0]==0.02`},y[x],{x,0,10}]

NDSolve[{y'[x]==v(c-y[x])/(k+c-y[x])y[x],y[0]==y0},y[x],x]

par=FindFit[data,y[x,a,c,y0],{{a,0.3},{c,13.5},{y0,0.0001}},x]

par=FindFit[data,y[x,a,c,y0],{{a,0.2},{c,20},{y0,0.1}},x]

par=FindFit[data,y[x,a,c,y0],{{a,1},{c,50},{y0,1}},x]

FindFit[data,y[x,a,c,y0],{a,c,y0},x]

FindFit[data,{y[x,a,c,y0],{a>0,c>0,y0>0}},{a,c,y0},x]

par=FindFit[data,y[x,a,c,y0],{{a,0.3},{c,13.5},{y0,0.0001}},x]

Fazni portret

s1=Plot[2-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.005},{Green,Thickness->0.005}}]

s1=Plot[0.2-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];
s2=Plot[0.4-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s3=Plot[0.6-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s4=Plot[0.8-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s5=Plot[1.0-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s6=Plot[1.2-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s7=Plot[1.4-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s8=Plot[1.6-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s9=Plot[1.8-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s10=Plot[2.0-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s11=Plot[2.2-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];
s12=Plot[2.4-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s13=Plot[2.6-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s14=Plot[2.8-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s15=Plot[3.0-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s16=Plot[3.2-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];s17=Plot[3.4-2 s,{s,0,1.5},PlotRange->{0,2.5},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]},PlotStyle->{{Blue,Thickness->0.002},{Green,Thickness->0.005}}];Show[s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17]

StreamPlot[{-2s,s},{s,0,3},{p,0,3},FrameLabel->{"S","P"},Frame->{True,True,False,False},FrameStyle->{Directive[14,Thickness[0.004]],Directive[14,Thickness[0.004]]}]