FRACLAB Functions Previous page   Next Page
boxdim_classique

Box dimension of the graph of a function from R^N to R computed using the box-method.

Syntax
[boxdim,Nboxes,handlefig]=boxdim_binaire(Signal, Size, Ratio, Axes, Waitbar ,reg, lrstr, optvarargin)

Inputs

Signal :
Usually, Signal is a 1-D array (values of a function), but it can also be a matrix 2-D array (Grayscale image, white pixels considered as peaks and dark pixels as valleys) or an N dimensional array with any N, where the function goes from R^N to R

Size, Ratio :
Ratio defines the lengths of the sides of a reference box. The length among the k-th axis of this reference box is Ratio(k) The successive boxes will be deduced from this first box by homotheties with ration Size(i). More precisely, the box at the i - th iteration will have a length along the k - th axis equal to Ratio(k)*Size(i)

Axes :
Domain of definition of the signal. For example, if f goes from [0,1]x[0,1] to R, then Axes=[0,1;0,1].
For a graphical explanation of Size, Ratio and Axes, see Example 1

Waitbar :
1 if you want a waitbar to appear during the calculation, else 0

reg :
The way you choose the bounds. See the help on fl_regression for more information.

lrstr,optvarargin :
Regression parameters. They define the regression type. Type " help monolr" for more information

Outputs

boxdim :
The estimated box dimension

Nboxes :
Nboxes is a vector. Nboxes(i) is the number of non-empty boxes at the i - th iteration. A non-empty box is a box that contains at least one point of the graph of the function.

handlefig :
If reg~=0, a window appears to help you choosing the linearity bounds. handlefig is the handle of this figure.

bounds :
Bounds of linearity of log2(Nboxes) in function of log2(Size). Interesting if reg==1.

Optional arguments

All arguments except Signal are optional. For example, the syntax : boxdim_classique(Signal) is correct. If you don't want to precise an argument, you can also type []. The missing arguments take their default values:

Size=[1 1/2 1/4 ... 1/2048 1/4096]
Ratio =[1 1 ...]
Axes=[0 1;0 1 ; ...]
Waitbar = 0
reg=0
lrstr='ls'

These default values are not always relevant, especially Size, so when you don't know how to define Size, try to use reg ~= 0 in order to precise manually the correct box sizes.

Examples

Example 1

This drawing may help you to understand the roles of Size, Ratio, and Axes.

It corresponds to the following intructions :

Signal=GeneWei(4096,0.6)+2;
Size=[1/2,1/4];
Ratio=[1,4];
Axes=[0,0.999] % Use 0.999 instead of 1 just to avoid side effects.
[boxdim,Nboxes,handlefig]=boxdim_classique(Signal, Size, Ratio, Axes)

These instructions will return Nboxes=[4,10]. It is consistent with the drawing. The computed dimension isn't meaningfull, because of the low number of iterations. The goal of this example is just to show how the boxes are defined.

Example 2

Computes the box dimension of a Weierstrass function.

% Computes a Weierstrass function with h=0.5
% Theorically, the box dimension of its graph is 2-0.5 = 1.5
Wei=GeneWei(4096,'0.5');
t=linspace(0,1,4096);
% Plot the graph
figure;plot(t,Wei);pause;
% Compute its box dimension
reg=1;
Waitbar=1;
[boxdim,Ntailles,handlefig,bounds]=boxdim_classique(Wei,[],[],[],Waitbar,reg);
boxdim
bounds

% You should find bounds = -4 0. This means that
% the progression is linear when log2(size) is in the range [-4 0]. You may keep these
% bounds, take more points and try another regression type.
reg=0;
Size=2.^[-4 : 0.1 : 0];
boxdim=boxdim_classique(Wei,Size,[],[],Waitbar,reg,'pls',30);
boxdim

See Also

boxdim_binaire, boxdim_listepoints, fl_regression