Example Code

Using Lookup Tables (LUTs) to Generate a Circle in LabVIEW with MathScript

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

Coding that benchmarks the time it takes to make a circle with using a Lookup table and other with a trigonometric function.

 

Description

This example shows how to use the interp1 MathScript Function to implement a lookup table. The VI generates a circle using both a LUT and only trigonometric functions to demonstrate the performance increase. For more information on using the interp1 function, check here: http://zone.ni.com/reference/en-XX/help/371361E-01/lvtextmath/msfunc_interp1/

 

This example will show how to use lookup tables to generate a circle. Lookup tables can save time in doing "expensive" calculations. The Lookup Table Generated has only 72 entries. The example calculates 360 points using the table.

 

Requirements
1. LabVIEW 2015 or compatible
2. Compatible MathScript RT Module.


Steps to Implement or Execute Code
1. Run the VI.
2. Compare the time of execution for both.


Additional Information or References

Capture.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
Todd S.
NI Employee (retired)
on

Great stuff! Thanks for sharing!

Todd S.
LabVIEW Community Manager
National Instruments