• 0

How to perform data acquisition with Analog Discovery and Matlab?



I want to record approx 50-1000 us long square wave signals from a separate waveform generator with Analog Discovery (Portable Analog Circuit Design Kit) via Matlab.

The official Matlab code for recording with an Analog Discovery does not work (http://se.mathworks.com/help/daq/examples/getting-started-acquiring-data-with-digilent-analog-discovery.html?search). Instead, the program is continuously busy when executing startForeground(s) and does not produce results.

The official Matlab code for waveform generation and acquisition at the same time (http://se.mathworks.com/help/daq/examples/acquiring-and-generating-data-at-the-same-time-with-digilent-analog-discovery.html?search ) works but allows only for a lower sample rate and takes too long to start measuring for my experiment. Which is why I would prefer to only record rather than outputting zero and recording the actual target signal simultaneously.

My Matlab code is

s = daq.createSession('digilent');
ch = s.addAnalogInputChannel('ad1', 1, 'Voltage');
s.Rate = 1e6;
s.Channels.Range = [-2.5 2.5];
s.DurationInSeconds = 2;
[data, timestamps, triggerTime] = startForeground(s);
plot(timestamps, data);
xlabel('Time (seconds)')
ylabel('Voltage (Volts)')
title(['Clocked Data Triggered on: ' datestr(triggerTime)])

Additional Info: I use the 1+ and 1- pins of the Analog Discovery, the support package Digilent Analog Discovery 15.2.0 is installed, MATLAB version R2015b.



Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now