Created
August 24, 2012 23:15
-
-
Save zeptometer/3457013 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a = [1,1,1,1,1,1]; //aのスポットは6個 | |
| b = [0,0,0,0,0,0,0]; //bのスポットは7個 | |
| k1=1;k2=1;kd=0.1; //平衡定数 | |
| y0=[3;2.9;0;0]; //各成分の初期値 | |
| deff("ydot=f(x,y)",.. | |
| "ydot=[y(1)*(k1/(1+y(1)+2*y(3))-kd);y(2)*(k1/(1+y(2)+2*y(4))-kd);.. | |
| y(2)*k2/(1+y(2))-y(3)*kd;y(1)*k2/(1+y(1))-y(4)*kd]"); | |
| Inc0=[0,15,0,0]'; | |
| Inc1=[15,0,0,0]'; | |
| z0=ode(y0,0,0:1:299,f); | |
| y1=ode(y0,0,300,f); | |
| z1=ode(y1+Inc0,300,300:1:599,f); | |
| y2=ode(y1+Inc0,300,600,f); | |
| z2=ode(y2+Inc1,600,600:1:900,f); | |
| z=cat(2,z0,z1,z2); | |
| ca=z(1,:); | |
| cb=z(2,:); | |
| //15*15のorigami | |
| paper=[0,0,2,2,2,4,4,4,1,1,0,2,2,0,0; | |
| 0,0,0,1,4,0,0,2,2,2,1,1,2,2,0; | |
| 0,0,4,2,0,0,0,2,2,2,2,2,1,2,0; | |
| 0,4,0,2,0,0,0,2,2,2,2,2,2,1,0; | |
| 0,4,0,1,4,4,0,0,2,1,1,1,2,4,0; | |
| 4,0,4,2,0,0,4,0,4,2,2,2,4,0,4; | |
| 4,0,1,2,2,4,4,0,4,0,2,4,4,0,4; | |
| 4,0,4,0,4,4,4,0,4,0,4,4,4,0,4; | |
| 1,2,2,4,4,1,0,0,2,4,4,4,2,0,4; | |
| 1,0,0,2,0,2,2,0,2,0,0,2,0,2,4; | |
| 1,0,0,2,0,2,2,0,2,0,2,0,0,0,1; | |
| 1,0,0,2,0,2,0,2,2,0,2,2,2,2,1; | |
| 1,0,4,2,0,2,0,1,2,0,2,0,4,0,1; | |
| 1,1,2,4,0,2,4,0,1,0,2,4,0,4,1; | |
| 4,0,0,0,4,4,0,0,0,4,4,0,0,0,4;] | |
| clf() | |
| plot2d(0,0,-1,"010"," ",[0,0,17,17]); //キャンバスの決定 | |
| for i=1:15 | |
| for j=1:15 | |
| if modulo(paper(i,j),2)==1 then | |
| xset("color",2) | |
| xfarc(1.1*(j-1),1.1*(15-i)+1,1,1,0,360*64) | |
| end | |
| end | |
| end | |
| for x=1:900 | |
| if modulo(x,50) == 0 then printf("x = %d\n",x) | |
| end | |
| for i=1:15 | |
| for j=1:15 | |
| if paper(i,j) == 2 | |
| k=rand() | |
| if k<0.05*ca(x) then paper(i,j)=3 | |
| xset("color",2) | |
| xfarc(1.1*(j-1),1.1*(15-i)+1,1,1,0,360*64) | |
| end | |
| elseif paper(i,j)==3 | |
| k=rand() | |
| if k<0.1 then paper(i,j)=2 | |
| xset("color",8) | |
| xfarc(1.1*(j-1),1.1*(15-i)+1,1,1,0,360*64) | |
| end | |
| elseif paper(i,j)==4 | |
| k=rand() | |
| if k<0.05*cb(x) then paper(i,j)=5 | |
| xset("color",2) | |
| xfarc(1.1*(j-1),1.1*(15-i)+1,1,1,0,360*64) | |
| end | |
| elseif paper(i,j)==5 | |
| k=rand() | |
| if k<0.1 then paper(i,j)=4 | |
| xset("color",8) | |
| xfarc(1.1*(j-1),1.1*(15-i)+1,1,1,0,360*64) | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment