I want to build Haar functions, which are defined as:
h_1_0 = function(t){ if ((t >= 0) & (t <= 1/2)){return(1)} else if ((t >= 1/2) & (t <= 1)){return(-1)} else{return(0)} }
Then the kth Haar function is:
h = function(t,n,k){return(2^((n-1)/2) * h_1_0((2^(n-1)) * t - k))}
For example, I want to draw h(t,1,1)
, it should be a function:
1, if 1<=t<=3/2 -1, if 3/2 <=t<=2 0, otherwise
So how can I build the kth functions with fixed k and n in R?
source share