How do I compute the fractal dimension of the Koch curve using Matlab?

Click For Summary
To compute the fractal dimension of the Koch curve in MATLAB, the box counting dimension method involves generating a meshgrid of the curve and counting filled boxes. The process requires padding the binary image of the Koch curve, setting the initial box size, and iteratively halving the box size while counting the occupied boxes. The Grassberger-Procaccia algorithm for correlation dimension is also mentioned, but specific implementation guidance is lacking. The final output for the box counting method is obtained by fitting a line to the log-transformed data points, with the slope representing the fractal dimension. Additional questions and clarifications are welcomed for further assistance.
crazy2006
Messages
5
Reaction score
0

Homework Statement



I have a problem trying to code these two programs, one is related to the obtain the fractal dimension of the Koch curve by using the method of the box counting dimension and also using the Grassberger-Procaccia algorithm

Homework Equations


For the box counting dimension is just the lim N(l)/l as l goes to zero, so first I should generate a meshgrid of the Koch curve and count the number of filled boxes, how I do that in matlab?
For the Grassberger Procaccia or correlation dimension I have reviewed the formula, but no idea how to implement it

The Attempt at a Solution


I have not really a code to follow here, so any help it would be great
 
Physics news on Phys.org
I have submitted an http://www.mathworks.com/matlabcentral/fileexchange/30329-hausdorff-box-counting-fractal-dimension" to compute the fractal dimension Matlab's files exchange.

The function takes as input a binary image I. In this image, nonzero pixels belong to an object (e.g. the kock curve) and 0 pixels constitute the background.

Basically, the algorithm consists in the following steps:

1 - Pad the image with background pixels so that its dimensions are a power of 2.
2 - Set the box size 'e' to the size of the image.
3 - Compute N(e), which corresponds to the number of boxes of size 'e' which contains at least one object pixel.
4 - If e > 1 then e = e / 2 and repeat step 3.
5 - Compute the points log(N(e)) x log(1/e) and use the least squares method to fit a line to the points.
6 - The returned Haussdorf fractal dimension D is the slope of the line.

If you have any questions, you are welcome to ask.
 
Last edited by a moderator:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
1
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
Replies
2
Views
1K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
725