BMat=rbind(c(0.333,0,0,0.333,-0.333,0),c(0.167,-0.289,0.289,0.167,-0.0830,0.144),c(0.167,0.289,-0.289,0.167,0.083,0.144),c(0.333,0,0,0.333,0.333,0))
# Initial conditions:
x=0
y=0
plot(0,0,xlim=c(-0.5,0.5),ylim=c(0,1),col="white")
COLOR=c("green","red","blue","yellow")
for(j in 1:10000)
{
i=sample(1:4,1) # ,prob=c(0.25,0.25,0.25,0.25)
x3=x
x=BMat[i,1]*x+BMat[i,2]*y+BMat[i,5]
y=BMat[i,3]*x3+BMat[i,4]*y+BMat[i,6]
points(x,y,pch=".",cex=1, col=COLOR[i])
}
Thursday, March 29, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment