Data Acquisition Toolbox    

Example: Performing a Linear Conversion

This example illustrates how to configure the engineering units properties for an analog input object connected to a National Instruments PCI-6024E board.

An accelerometer is connected to a device which is undergoing a vibration test. Your job is to measure the acceleration and the frequency components of the device while it is vibrating. The accelerometer has a range of ±50 g's, a voltage sensitivity of 99.7 mV/g, and a resolution of 0.00016 g.

The accelerometer signal is input to a Tektronix TDS 210 digital oscilloscope, and to channel 0 of the data acquisition board. By observing the signal on the scope, the maximum expected range of data from the sensor is ±200 mV, which corresponds to approximately ±2 g's. Given this constraint, you should configure the board's input range to ±500 mV, which is the closest input range that encompasses the expected data range.

You can run this example by typing daqdoc5_8 at the MATLAB command line.

  1. Create a device object -- Create the analog input object AI for a National Instruments board. The installed adaptors and hardware IDs are found with daqhwinfo.
  2. Add channels -- Add one hardware channel to AI.
  3. Configure property values -- Configure the sampling rate to 200 kHz and define a two second acquisition.
  1. Configure the engineering units properties. This example assumes you are using a National Instruments PCI-6024E board or an equivalent hardware device. SensorRange is set to the maximum accelerometer range in volts, and UnitsRange is set to the corresponding range in g's. InputRange is set to the value that most closely encompasses the expected data range of ±200 mV.

  1. Acquire data -- Start the acquisition.
  1. Extract and plot all the acquired data.

    Calculate and display the frequency information.

    Make sure AI has stopped running before cleaning up the workspace.

  1. Clean up -- When you no longer need AI, you should remove it from memory and from the MATLAB workspace.

  Linearly Scaling the Data: Engineering Units Analog Output