Example Code

Draw your own fractal using LabVIEW

产品和环境

本部分要求填写创建该范例所需的产品和操作系统。

如要下载NI软件(包括以下所示产品),请访问ni.com/downloads

    软件

  • LabVIEW

代码和文档

添加附件

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

NI社区“代码范例交流区”(Example Code Exchange)中的代码范例已获得MIT许可

评论
alexderjuengere
Active Participant
Active Participant
修改时间

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
修改时间

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
修改时间

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