File Exchange

image thumbnail

Sierpinski triangle (2D,3D,any triangle shape,option double)

version 4.0 (202 KB) by Mathworlds
Function to compute, display, and save the Sierpinski triangle defined by three given points of the 2D or 3D space, at any iteration number.


Updated 07 Feb 2021

From GitHub

View Version History

View license on GitHub

Please check the examples tab (.mlx doc) here on the right for a complete description.

Once downloaded, typewrite 'doc Sierpinski_triangle' or 'help Sierpinski_triangle' in Matlab console for support.

For 2D point inputs, just padd the point Z coordinate with a zero (see example #2)

To benefit from the file documentation attached, be sure to download the file, not to just copy and paste it.

Cite As

Mathworlds (2021). Sierpinski triangle (2D,3D,any triangle shape,option double) (, GitHub. Retrieved .

Comments and Ratings (3)


Cover image is an exemple of the 'double' option use on at iteration #2. Triangles have different sizes and then their edge lenghts.


+ option double Sierpinski


Default maximum number of iterations (nb_max_it) set to 9. Increase it line 125.

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!