Multifractal

Probability Distribution Multiple Scaling

During this lecture we have seen that it is of interest to estimate function to characterize the studied field. Then, it is important to calculate directly. In this exercise we will introduce the Probability Distribution Multiple Scaling technique which allows us to estimation the co-dimension function.

C(\gamma) = - \frac{log (Pr(\varepsilon_\lambda \geq \lambda^{\gamma}))}{log(\lambda)}

Question

Using the given data:

  • Write a script to estimate the singularities for each resolution

  • Write a script which calculates the probability that the field exceed the values

  • According the above equation write a script to calculate the function

data.zip

Hint
  • We choose in this exercise the Scilab programming language (free).

Solution
1
// Main
2
clear;
3
clc;
4
5
exec("Upscaling.sce");      // UpScale
6
exec("Probability.sce");    //ProbaSup
7
exec("Cgamma.sce");         //PDMS
8
exec("Gamma.sce");          // GammaValues
9
10
flux = fscanfMat("data.txt")
11
12
sample_res = 10;
13
14
[gamas]=GammaValues(flux,sample_res)
15
16
rng =[1:sample_res];
17
18
lambdas = 2^sample_res./(2.^(0:sample_res));
19
20
for j= 1:length(gamas)
21
    [c_gammas(j),y1,x1] = PDMS(flux,gamas(j),lambdas,rng);
22
23
end
24
plot(gamas,c_gammas)
1
function [gamas]=GammaValues(data,sample_res)
2
    
3
    data = data(1:2^sample_res);
4
    
5
    for i = 1:sample_res
6
        new_data = UpScale(data,i);
7
        s = log(new_data./mean(new_data))./log(length(new_data));
8
        gamma_max_lambdas = max(s);
9
        gammas_max_lam(i) = gamma_max_lambdas;
10
    end
11
    
12
    gamma_max = min(gammas_max_lam);
13
    gamma_min = min(log(data./mean(data))./log(length(data)));
14
    gamas = linspace(0,gamma_max,1000);
15
    
16
endfunction
17
1
function [data_res_bas] = UpScale(data,iterations)
2
    
3
    data_res_bas=[];
4
    defactor = 2;
5
    step = defactor^(iterations-1);
6
    newlen=floor(length(data)/step);
7
    
8
    data_res_bas=zeros(1,newlen);
9
    
10
    for i = 1:newlen
11
        data_res_bas(i) = sum(data((i-1)*step+1:i*step))./step; 
12
    end
13
    
14
endfunction
15
1
function [p]=ProbaSup(data,threshold)
2
    nb_sup=0;
3
    nb_tot=length(data);
4
    for i=1:length(data)
5
        if data(i)>=threshold
6
            nb_sup=nb_sup+1;
7
        end
8
    end
9
    p=nb_sup/nb_tot;
10
    
11
endfunction
12
1
function [c_gamma,y1,x1] = PDMS(data,gama,lambdas,rng)
2
    
3
    data = data(1:2^length(rng));
4
    
5
    for i=1:length(rng)
6
        if i==1
7
            data_lambda=data./mean(data);
8
        else
9
            data_lambda=UpScale(data,i);
10
            data_lambda = data_lambda./mean(data_lambda);
11
        end
12
        proba(:,i) = ProbaSup(data_lambda,(lambdas(i))^gama);
13
    end
14
    
15
    l1=1; l2=length(rng);    
16
    x1=log(lambdas(l1:l2)); 
17
    y1=log(proba(:,l1:l2));   
18
    [pente]=reglin(x1,y1,1);
19
    c_gamma = -pente(1);
20
    
21
endfunction
22
23
PreviousPreviousNextNext
HomepageHomepagePrintPrintCreated with Scenari (new window)