# Characteristic function of [0,1): # one(t) = 1, if 0==0) { if(t<1) { return(1); } } return(0); } # Stationary subdivision: ss <- function( h, n, t) { if(n<=0) return(one(t)); out <- h; for(k in 1:length(h) ) { out[k] <- h[k]*ss(h,n-1,2*t-(k-1)); } return(sqrt(2)*sum(out)) } # Plot the Daubechies 4 scaling function depth <- 4; # number of iterations from one() numpts <- 100; # number of points to plot sr3 <- sqrt(3); h<-c((1+sr3)/4, (3+sr3)/4, (3-sr3)/4, (1-sr3)/4); # D4 coefficients d4 <- 1:numpts; for(x in 1:numpts) d4[x] <- ss(h, depth, 3*x/numpts); plot(d4, type="l")