Modeling2.html
From 2013.igem.org
(Difference between revisions)
Line 328: | Line 328: | ||
}; | }; | ||
+ | |||
+ | var interactiveSolver = function (icONE, icTWO) { | ||
+ | this.yone = []; | ||
+ | this.ytwo = []; | ||
+ | this.t = []; | ||
+ | t.push(0); | ||
+ | this.yone.push(icONE); | ||
+ | this.ytwo.push(icTWO); | ||
+ | |||
+ | var counter = 0; | ||
+ | var odePart; | ||
+ | while (1===1){ | ||
+ | if (this.yone[counter] < 2 ) | ||
+ | if (this.yone[counter] > 0.05) | ||
+ | if (this.ytwo[counter] > 0.05) | ||
+ | if (this.ytwo[counter] < 2) { | ||
+ | odePart = odefunX(this.yone[counter], this.ytwo[counter]); | ||
+ | this.yone.push(odePart[0]*dt + this.yone[counter]); | ||
+ | this.ytwo.push(odePart[1]*dt + this.ytwo[counter]); | ||
+ | counter++; | ||
+ | this.t.push(counter*dt); | ||
+ | } | ||
+ | else{ | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | textFont(myFont, 18); | ||
+ | fill(0, 0, 0); | ||
+ | textAlign(CENTER, CENTER); | ||
+ | |||
+ | noFill(); | ||
+ | if (this.yone[counter] > 0.8) { | ||
+ | |||
+ | text("The Population Survives!", graphxMin + graphWidth/2, dieHeadingY); | ||
+ | //dead = false; | ||
+ | stroke(0, 250, 0); | ||
+ | } | ||
+ | else { | ||
+ | text("The Population Dies", graphxMin + graphWidth/2, dieHeadingY); | ||
+ | //dead = true; | ||
+ | stroke(250, 0, 0); | ||
+ | } | ||
+ | rect(graphxMin, 7, graphWidth, 80, 10); | ||
+ | |||
+ | |||
+ | plotSolution(this.yone, this.ytwo, graphyMin, 1); | ||
+ | plotSolution(this.t, this.ytwo, graph2yMin); | ||
+ | plotSolution(this.t, this.yone, graph2yMin); | ||
+ | |||
+ | |||
+ | var eColiY= - (this.ytwo[0] - yMin)*graphHeight/yLength + graph2yMin; | ||
+ | var yeastY= -(this.yone[0] - yMin)*graphHeight/yLength + graph2yMin; | ||
+ | drawYeast(graphxMin, yeastY); | ||
+ | drawBacteria(graphxMin, eColiY); | ||
+ | // drawBacteria(graphxMin - 40, graphyMin - graphHeight*5/8); | ||
+ | // drawYeast(graphxMin + graphWidth*5/9 + 10, graphyMin + 45); | ||
+ | }; | ||
Revision as of 23:39, 27 September 2013