Here's an example code for drawing a Sierpinski triangle in MATLAB using recursion:
main.m571 chars25 lines
Here's how you can call the sierpinski
function:
main.m25 chars2 lines
This will draw a Sierpinski triangle with side length 10 and recursion depth 4. You can adjust these parameters to get a different shape or level of detail.
gistlibby LogSnag