Example Code

Calculate the Magnitude of a Vector

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 exemplifies how to calculate the magnitude of a vector by two separate means.

 

Description

This VI shows how to calculate a vector's magnitude using two different methods. One method uses the complex math routines in LabVIEW, and the other uses the Pythagorean Theorem, given the X and Y magnitudes.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code
1. Insert the values for X and Y
2. Select the Run button.

 

Additional Information or References

Snippet.png

Product Support Engineer
National Instruments

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