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:
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.
AO
for a sound card. The installed adaptors and hardware IDs are found with daqhwinfo
.
AO
.
putdata
.
duration = 4; set(AO,'SampleRate',8000) set(AO,'TriggerType','Manual') ActualRate = get(AO,'SampleRate'); len = ActualRate*duration; data = sin(linspace(0,2*pi*500,len))'; putdata(AO,data)
AO
, issue a manual trigger, and wait for the device object to stop running.
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.
AO
for a National Instruments board. The installed adaptors and hardware IDs are found with daqhwinfo
.
AO
.
putdata
.
duration = 4; set(AO,'SampleRate',10000) set(AO,'TriggerType','Manual') ActualRate = get(AO,'SampleRate'); len = ActualRate*duration; data = sin(linspace(0,2*pi*500,len))'; putdata(AO,data)
AO
, issue a manual trigger, and wait for the device object to stop running.
AO
, you should remove it from memory and from the MATLAB workspace.
![]() | Outputting Data | Evaluating the Analog Output Object Status | ![]() |