Data Acquisition Toolbox    

Analog Output Examples

This section illustrates how to perform basic data acquisition tasks using analog output subsystems and the Data Acquisition Toolbox. For most data acquisition applications using analog output subsystems, you must follow these basic steps:

  1. Install and connect the components of your data acquisition hardware. At a minimum, this involves connecting an actuator to a plug-in or external data acquisition device.
  2. Configure your data acquisition session. This involves creating a device object, adding channels, setting property values, and using specific functions to output data.

Simple data acquisition applications using a sound card and a National Instruments board are given below.

Outputting Data with a Sound Card

In this example, sine wave data is generated in MATLAB, output to the D/A converter on the sound card, and sent to a speaker. The setup is shown below.

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

  1. Create a device object -- Create the analog output object AO for a sound card. The installed adaptors and hardware IDs are found with daqhwinfo.
  2. Add channels -- Add one channel to AO.
  3. Configure property values -- Define an output time of four seconds, assign values to the basic setup properties, generate data to be queued, and queue the data with one call to putdata.
  4. Output data -- Start AO, issue a manual trigger, and wait for the device object to stop running.
  5. Clean up -- When you no longer need AO, you should remove it from memory and from the MATLAB workspace.

Outputting Data with a National Instruments Board

In this example, sine wave data is generated in MATLAB, output to the D/A converter on a National Instruments board, and displayed with an oscilloscope. The setup is shown below.

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

  1. Create a device object -- Create the analog output object AO for a National Instruments board. The installed adaptors and hardware IDs are found with daqhwinfo.
  2. Add channels -- Add one channel to AO.
  3. Configure property values -- Define an output time of four seconds, assign values to the basic setup properties, generate data to be queued, and queue the data with one call to putdata.
  4. Output data -- Start AO, issue a manual trigger, and wait for the device object to stop running.
  5. Clean up -- When you no longer need AO, you should remove it from memory and from the MATLAB workspace.

  Outputting Data Evaluating the Analog Output Object Status