Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Nov 27, 2007


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

LabVIEW Analysis FAQ

5 ratings | 3.80 out of 5
Print

Overview

NI LabVIEW includes a variety of tools for analysis including built-in functions (VIs) and add-on toolkits for visualization, mathematics, and signal processing. The LabVIEW Full and Professional Development Systems include an extensive (600+ VIs) library of tools that can be applied to analysis. Examples of add-on toolkits that extend LabVIEW with new functionality for analysis include the NI LabVIEW Digital Filter Design Toolkit, the NI LabVIEW Sound and Vibration Toolkit, the Modulation Toolkit, and the NI LabVIEW Advanced Signal Processing Toolkit.

Overview

Advanced analysis consists of the following features and VIs that ship with the LabVIEW Full and Professional Development Systems, the LabVIEW Student Edition, and the NI Developer Suite Core Package:

  • Signal Generation -- sine wave, square wave, triangle wave, noise, impulse, and so on.
  • Digital Signal Processing -- Fourier and Hilbert transform, correlation, convolution, power spectrum
  • Measurement -- Amplitude and Phase response, impulse response, peak detector, harmonic analyzer, histogram
  • Windows -- various time-domain windows for spectral analysis
  • Filters -- Butterworth, Chebyshev, Elliptic, general IIR and FIR, Bessel, Median filters
  • Probability and Statistics -- mean, deviation, probability distributions, variance, RMS, mode
  • Linear Algebra -- matrix (or vector) multiplication, determinant, inverse, rank, dot product, outer product
  • Curve Fitting -- linear, exponential, polynomial fits, splines, interpolation
  • Array Operations -- polynomial evaluation, unit vector, scaling, polar <-> rectangular conversion
  • Additional Numerical Methods -- numerical integration, root finder, peak detection
  • Script node interfaces to the XMath software and The MathWorks, Inc. MATLAB® software application
  • MathScript textual math for .m file script programming

The NI LabVIEW Digital Filter Design Toolkit extends LabVIEW with functions and interactive tools for design, analysis, and implementation of digital filters. The NI LabVIEW Sound and Vibration Toolkit extends LabVIEW functions and indicators to handle audio measurements, fractional-octave analysis, swept sine analysis, sound-level measurements, frequency analysis, frequency response measurements, transient analysis, and several sound and vibration displays. The NI LabVIEW Advanced Signal Processing Toolkit is a suite of software tools, example programs, and utilities for time-frequency analysis, time-series analysis, and wavelets.

Common Questions (and Answers)

Signal Generation

What is normalized frequency?

Normalized frequency is expressed in units of cycles per sample. Normalized frequency is calculated by dividing the frequency of the waveform in Hertz by the sampling rate in samples per second. For example, a 20Hz sine wave sampled at a rate of 10 KHz has a normalized frequency = 20/10K = 0.002 cycles/sample. Normalized frequency is also calculated by dividing the number of desired cycles by the number of samples. For example, a triangle wave with 2 cycles in 100 samples has a normalized frequency = 2/100 = 0.02 cycles/sample.

If I want to create a sine wave, should I use the Sine Pattern VI or the Sine Wave VI?

The basic difference between the Sine Pattern VI and the Sine Wave VI is that the Sine Wave VI can keep track of phase information between calls, and the Sine Pattern VI cannot. The Sine Pattern VI does not track the final phase of the most recently generated sine. Using the Sine Wave VI, you can specify whether the initial phase of the sine is the final phase of the sine generated on the last call to the VI, or whether it is the phase fed into the phase in input. Simply set the reset phase input of the Sine Wave VI to FALSE and simulate continuous waveforms.

I want to simulate noise in my signal. What is the difference between the Uniform White Noise VI and the Gaussian White Noise VI?

The Uniform White Noise VI generates values between -a and a, where a is a given constant. These values are uniformly distributed, which means you are as likely to get a particular amplitude as any other (within the given bounds). The Gaussian White Noise VI generates random values centered at zero with a given standard deviation. The distribution is based on a Gaussian probability distribution, which means values near zero are more likely than those far from zero. Also, there are no upper or lower limits on the range of the values generated.

Fourier Transforms and Frequency Analysis

What is a Fourier transform?

A Fourier transform is a mathematical operation that transforms a signal from the time domain to the frequency domain, and vice versa. In the time domain, the signal is expressed with respect to time. In the frequency domain, a signal is expressed with respect to frequency.

What is a DFT? What is an FFT? What is the difference?

A discrete Fourier transform (DFT) is the name given to the Fourier transform when it is applied to a digital (discrete) signal rather than an analog (continuous) signal.

A fast Fourier transform (FFT) is a name given to a class of algorithms that efficiently implement the DFT.

What is the difference between the Cross Power VI, the Cross Power Spectrum VI, the Power Spectrum VI, and the Auto Power Spectrum VI?

The Cross Power Spectrum VI and the Auto Power Spectrum VI are high-level VIs. The others are low-level. It is usually best to stick with the high-level VIs. The Auto Power Spectrum VI computes the power present in the signal, but you lose phase information. The Cross Power Spectrum VI computes the power present in both signals and returns the phase difference between them.

Some of the analysis VIs output in units of Vrms2. What does that mean?

This means that the output of the VI is in root mean square (RMS) units if the input sequence is in non-RMS units. The RMS value of a waveform is calculated as the square root of the mean of the squares of each data point. It can be thought of as a kind of average, though not mathematically the same as the arithmetic mean. For example, the RMS amplitude of a sine wave of amplitude 1 would be 1/√2, or 0.707, while the average value of a sine wave (over an integral number of cycles) is 0.

What is the best VI to use if I want to know the frequency content of a signal?

The most straightforward is the Amplitude and Phase Spectrum VI. The Amplitude and Phase Spectrum VI provides the amplitude and phase at N/2 frequency components evenly spaced between DC (0 Hz) and the Nyquist frequency (which is half the sampling frequency), where N is the number of samples in the time domain signal. This VI provides a single-sided spectrum, which differs from the FFT in that there are no negative frequencies.

What is the space between adjacent frequency components? How can I change the spacing?

Most of these measurement VIs provide an output labeled "df". This is the frequency difference between adjacent components, measured in Hz if dt (the difference between time domain samples) is provided to the VI in seconds. df is explicitly calculated as fs/N, where fs is the sampling frequency and N is the length of the time-domain sequence. In order to change df, you must change either fs or N. One way to increase N is to use zero padding. Refer to the following question for more information about zero padding.

What is zero padding?

Zero padding means adding zeros to the beginning and/or end of the time domain sequence. This addition does not affect the frequency spectrum of the signal. Zero padding is a good idea when the length of the time domain sequence is not a power of two. Adding enough zeros to make the sequence a power of two results in faster FFT calculations. Zero padding also increases the frequency resolution of an FFT. Refer to the previous question for more information about frequency differences.

When using the FFT VIs, where are the negative frequencies stored?

The Auto Power Spectrum VI, the Amplitude and Phase Spectrum VI, the FFT Power Spectrum VI, the FFT Power Spectral Density VI, the FFT Spectrum (Mag-Phase) VI, and the FFT Spectrum (Real-Im) VI compute single-sided spectrum while the FFT VI and the Power Spectrum VI compute two-sided spectrum. "Two-sided spectrum" implies that the output of the VI includes negative frequencies that exist purely as a mathematical property of the Fourier transform. The first half of the FFT output array contains frequencies from DC (0 Hz) to the Nyquist frequency in ascending order. The second half of the array is a mirror image of the first half (mirrored at approximately the middle element) and contains the negative frequencies.

What is the dtinput?

dt is the time between samples in the time-domain input signal. If you know the sampling rate (Fs) at which the signal was acquired, you easily can calculate dt by using dt = 1/Fs.

Filters and Windows

How do I get rid of certain frequencies in my signal?

Use one of the filter VIs to get rid of certain frequencies in your signal. The most popular filter VIs are the Butterworth Filter VI and the Chebyshev Filter VI. They can be configured as lowpass, highpass, bandpass, or bandstop.

Why does LabVIEW have to input the sampling frequency?

Without this input, the filter has no way to establish time or frequency information about the signal and subsequently cannot perform the filtering.

What effect does increasing the filter order have?

There is both a positive effect and a negative effect to increasing the filter order. The positive effect of increasing the filter order is more accurate filtering. The negative effect is additional computation time and additional settling time. There is also a diminishing return on increasing the filter order. Orders above ten are usually unnecessary, and IIR filter orders greater than 20 can lead to numerical inaccuracy.

I get a delay at the beginning of my signal after filtering. How do I get rid of it?

This delay at the beginning of your signal after filtering is usually the result of a high filter order. To fix this problem, set the init/cont input of the filter to TRUE. Setting init/cont to TRUE means you want to use continuous filtering, which is logical since you are feeding multiple portions of a continuous signal to subsequent filtering operations (simulating real-time filtering).

What are IIR and FIR filters?

FIR stands for finite impulse response. FIR filters respond to an impulse (a spike of infinitely large amplitude and infinitely short duration) only for a finite amount of time. That is, after a certain time, the output of the filter is zero. Infinite impulse response (IIR) filters have a non-zero output infinitely far into the future when subjected to an impulse input.

What is a window?

A window is a multiplier for a time domain signal. Ideally we would have access to an infinite time domain waveform. The purpose of a window is to remove (or smooth) the discontinuities that exist at the beginning and end of a sample. If not removed, these discontinuities manifest as frequencies higher than the Nyquist frequency when sampling occurs.

Which windows should I use?

The Hanning window is good for general-purpose use. The other windows sometimes work better with more specific uses. It is not always possible to know in advance which window is best.

Linear Algebra

Why isn't my matrix multiplication working?

A common error arises when using the A x B VI. Remember that matrix multiplication is not commutative, so the order of the inputs matters. The orders of the matrices can cause errors, too. The orders of matrices A and B should be m by n and n by k, respectively, where m, n, and k are positive integers.

Why do I get error -20041 when I use the Inverse Matrix VI?

Not every matrix can be successfully inverted. Most likely the matrix that you are trying to invert has been miscalculated due to a mistake elsewhere in the code. You also can try using the PseudoInverse Matrix VI.

5 ratings | 3.80 out of 5
Print

Reader Comments | Submit a comment »

Crisp replies
- masterjk_1212@yahoo.com - Oct 3, 2007

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).