Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Statistical Analysis: an Introduction using R/Introduction

From Wikibooks, open books for an open world
<Statistical Analysis: an Introduction using R

library(caTools) # external package providing write.gif functionjet.colors <- colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F",

                                "yellow", "#FF7F00", "red", "#7F0000"))

m <- 1200 # define sizeC <- complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),

             imag=rep(seq(-1.2,1.2, length.out=m), m ) )

C <- matrix(C,m,m) # reshape as square matrix of complex numbersZ <- 0 # initialize Z to zeroX <- array(0, c(m,m,20)) # initialize output 3D arrayfor (k in 1:20) { # loop with 20 iterations

 Z <- Z^2+C             # the central difference equation   X[,,k] <- exp(-abs(Z)) # capture results

} write.gif(X, "Mandelbrot.gif", col=jet.colors, delay=100)

Retrieved from "https://en.wikibooks.org/w/index.php?title=Statistical_Analysis:_an_Introduction_using_R/Introduction&oldid=3117315"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp