Example Code

Draw your own fractal 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

Download All

Overview
This VI demonstrates how to use computers to represent abstract fractals by calculating and evaluating functions recurrently and assigning a color representation for each result..


Description
Here is a brief description of the example:

Program to draw a Julia set fractal (n=2)

This program evaluates f(z) = z^2 + c with z = X+Yi and c = A+Bi  being X,Y,A and B real numbers. This program iterates using:

Xn+1 = (Xn)^2-(Yn)^2 +a

Yn+1= 2(Xn)(Yn) + b

The resulting image has  1920x1080 pixels (a value that can be increased or reduced). The program uses IMAQsetcolorpixel.vi from the Vision Developer Module and Vision Acquisition Software for Labview 2014.

 

Requirements

  1. LabVIEW 2014 (or compatible)


Steps to Implement or Execute Code

  1. Assign a value for Xmax, Xmin, Ymin, Ymax, M (radius), a and b.
  2. Choose the color spectrum to show how divergent or convergent each function evaluation is.
  3. Run the program.
  4. Change the size of the image by changing the N terminals of each for loop and the input terminals of the IMAQ create.vi.

Additional Information or References

VI Snippet

FRACTAL 2014 NIVerified.vi.png

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

Erwin Franz

Certified LabVIEW Architect, Certified TestStand Developer

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

Comments
alexderjuengere
Active Participant
Active Participant
on

Nice! Using the colortables found here und the While Loop's R instead of Y to index those colortables, your vi is rendering somthing like this:

2016-02-04_fractal.PNG

EFranz
Member
Member
on

I really like it, thanks for sharing!.

I  modified the code to generate the following image based on the code I found here.

VI saved as FRACTALrender.vi

Hope you like it.

fractal_render.png

Erwin Franz

Certified LabVIEW Architect, Certified TestStand Developer
MarcDub
Active Participant
Active Participant
on

Great VI. I played with it for while and ended up adding some UI features. It is posted at Draw your own fractal 2

Marc Dubois

www.harotek.com

Marc Dubois