Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 

Acquiring Data with a National Instruments Board

Suppose you must verify that the nominal frequency of a sine wave generated by a function generator is 1.00 kHz. To perform this task, you will input the function generator signal into a National Instruments board. You will then perform an FFT on the acquired data to find the nominal frequency of the generated sine wave. The setup for this task is shown below


Configuring the Data Acquisition Session

As described in "The Data Acquisition Session", using the Data Acquisition Toolbox to acquire data involves these steps:

For this application, you will acquire one second of data on one input channel. The board will be set to a sampling rate of 10 kHz, which is well above the expected Nyquist frequency of the input signal. Therefore, aliasing effects should not be present. After you have connected the input signal to the board, you will trigger the acquisition one time using a manual trigger. The complete data acquisition session for the sound card is shown below.

Initialization: Create the analog input object AI for a National Instruments board. The installed adaptors and hardware ID's are found with daqhwinfo.

Configuration: Add one channel to AI, assign values to the basic setup properties, and create the variables blocksize and Fs, which are used for subsequent analysis. The actual sampling rate is retrieved since it may be set to a value that differs from the specified value.

Execution: Start AI, issue a manual trigger, and extract all data from the engine. Before start is issued, you should begin inputting data from the function generator into the data acquisition board.

Termination: Delete AI.

MATLAB Analysis

For this experiment, analysis consists of finding the frequency of the input signal and plotting the results. The signal frequency can be found with daqdocfft.

This function, which is shown on page 3-19, calculates the FFT of data, and requires the values of SampleRate and SamplesPerTrigger as well as data as inputs. daqdocfft outputs the frequency and magnitude of data, which can then be plotted.

The results are plotted below.

This plot shows the nominal frequency around 500 Hz. A simple way to find actual frequency is shown below.

The answer is 994 Hz.



[ Previous | Help Desk | Next ]