From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Mandelbrot Set Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This example creates the Mandelbrot set and colors it with a continous color (smoothing) algorithm.

 

Description
By default the iteration count is set to 50 and is colored with a 24-bit color gradient.

The black section is the set of points in the complex plane. The edge forms a fractal (the complexity of this edge never simplifies regardless of the magnification level).

The outside area is colored based on the number of iterations it takes to exclude the pixel from the Mandelbrot set.

 

Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

 

  1. Run the VI
  2. 2.Mandelbrot image will show on front panel.

 

Additional Information or References
VI Block Diagram

 1.png

 

 

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
TroyK
Active Participant
Active Participant
on

Awesome, I love it. (My windows background is a zoomed in section of the Mandelbrot set fractal. Step12 in the link in your introduction.)

I hope you don't mind, I simplified the code a little, changed the way the picture updated and did a bit of manual tidying.

It updates much faster now. (Original took about 30seconds on my pc.)

See 'mandelbrot_lv82_2.vi'.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
StevieZ
NI Employee (retired)
on

Thanks for updating it, I love the speed improvements. Based off your version of the code I may work on a version that will be able to be zoomable.

TroyK
Active Participant
Active Participant
on

Your welcome! A zoom would be very cool. I wanted to suggest that but I forgot to add it to my previous comment.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Everseeker
Member
Member
on

So, 7 years later....

Did you (or anyone) create a zoomable version?

And, the "Improved" one that is in the comment... is not clickable does anyone have it?

TroyK
Active Participant
Active Participant
on

I can't remember where I got the one just attached from (Mandel.vi) but if you turn on the cursors it is zoomable. It was originally written in LabVIEW 5 I think!

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
dj_tony
Member
Member
on

i have a zoomable version. i don't remember who made it or where i found.

and if you enable item parallelism on the for loops the execution speed increase drammatically.

here the link:

 

https://drive.google.com/file/d/1gUvi3wypyI6pkiTJ92VJIjZDp5Dshi9P/view?usp=sharing

 

 

fell free to put this VI in other places more appropriate.

-------------------------------------------------------------------------------------
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
rowdyr
Member
Member
on

Here is another zoomable version that can be manipulated with the mouse which was based on the VIs at the top of the page...

 

Mandelbrot Explorer.jpg

 

https://www.icloud.com/iclouddrive/0eeohs3Hr7D3BC-ZGzeSDuNnA#Mandelbrot_Explorer

 

Enjoy.