Resample Waveforms with One Simple Express VI
Overview
This article discusses software-based resampling is one of the new features of LabVIEW 7 Express, which includes an interactive Align and Resample Express VI and a traditional waveform datatype VI.
Table of Contents
Introduction
Signal comparison is often not a trivial task. Even simple tasks, such as adding or subtracting waveforms, can be difficult – especially if the signals you are comparing lack common timestamps, sampling rates, and durations. You can handle simultaneously sampled signals using an NI-PXI-4472 dynamic signal acquisition device or resample the waveforms to change the timestamps, sample period, and duration of a signal to match another signal.A common example of the usefulness of resampling is performing audio manipulation with professional audio equipment. While these devices typically use a sampling rate of 48 kHz, home equipment typically processes sound at 44.1 kHz. Transferring sound from one system to the other requires that you resample one of the signals to match the other. With care, you can accomplish this without affecting the quality of the sound.
Software-based resampling is one of the new features of LabVIEW 7 Express, which includes an interactive Align and Resample Express VI and a traditional waveform datatype VI. In short, interpolation, as applied to resampling, predicts new values based on existing signal samples that you input. The LabVIEW Express VI, gives you four methods of interpolation:
Linear Interpolation
The linear interpolation method assumes that you know two neighboring samples of the waveform, and that between those two samples the signal changes at a constant rate. The algorithm essentially draws a straight line between these two samples and returns the appropriate point along that line.
Coerce Method
This method returns an output sample value equal to the input sample value closest to the output sample value in time. An advantage of the coerce method is that it requires almost no computation.
Spline Interpolation
The spline method uses the spline interpolation algorithm to compute the resampled values. The LabVIEW 7 Express implementation relies on a cubic spline, yielding smooth transitions between the samples and good quality on single-shot short records.
FIR Filter-Based Interpolation
This method applies a digital finite impulse response (FIR) filter to compute the resampled values. With the LabVIEW 7 Express implementation, you can set the attenuation level of aliased signal components. A normalized bandwidth selection also specifies the fraction of the smallest of input and output not attenuated. For example, when going from 44.1 to 48 kHz or from 48 to 44.1 kHz, you would always define these rates as the specified fraction of 44.1 kHz. This method provides excellent results for frequency analysis, although it is more intensive computationally.
Resampling is not only useful in the time domain. You also can use the resampling functionality to compare spectra with different Äf or f0. Or, you can use it to compare, for example, a logarithmic frequency-swept SPICE model with a linear frequency-axis FFT measurement.
The LabVIEW Align and Resample VI is optimized for two modes of operation -- single-shot and continuous. In single-shot mode, the function has a time-symmetric behavior and distributes the interpolation settling error on both sides, while the continuous settles only at the beginning of the first record but then expects the following input blocks to be time contiguous. For example, you can use the continuous mode to resample one hour of music from 44.1 to 48 kHz in one-second blocks.
This Express VI is one of the 13 new Express VIs made available in LabVIEW 7 Express. These Express VIs encompass the most frequently-used functions from the more than 400 available measurement analysis and signal processing functions in LabVIEW.
Reader Comments | Submit a comment »
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/).

