More With MATLAB And The Analog Discovery 2

If you frequent the Digilent Blog or our Forum, you may have heard that the Analog Discovery 2 is now supported in the MATLAB Data Acquisition toolbox! With the release of MATLAB 2018b, the Analog Discovery 2 is now included as one of the many hardware devices supported by MATLAB.

The Data Acquisition Toolbox Support Package for the Analog Discovery 2 includes libraries for:

  • Read data from the two oscilloscope channels (analog input)
  • Control and generate data from the two waveform generators (analog output)
  • Characterize ICs and measure behavior of the circuit and IC components
  • Configure the sampling rate of the Analog Discovery device
  • Trigger the start of your data acquisition
  • Find and display Digilent Analog Discovery device settings

Today we are going to provide some examples of these libraries and documentation. The first example is the result of running the demo that runs the Waveform Generator and Oscilloscope. In the example below, they are plugged into each other:

We can also run this demo as a live script.  Running the demo as a live script allows the code and results to live on the same page and be shown live. This is similar to the Python Jupyter notebooks example from the WaveForms Asset Store.

 

 

Result of running the same demo as a live script.
The results of running the demo as a live script (scrolled down to the graph).

 

It can be helpful to have an idea of the structure as well when using these resources. To break it down:

MATLAB: The programming language and development environment

Data Acquisition Toolbox: Specific set of examples and libraries that allows the use of Data Acquisition hardware

Analog Discovery Hardware Support Package: Additional download that allows the use of the Analog Discovery 2 in the Data Acquisition Toolbox. Downloading and installing this also adds three examples to the example folder. One that uses the Scope, one that uses the Wavegen and one that uses both.

If you are confused on how to acquire the Analog Discovery hardware package, first make sure that you must also have the Data Acquisition Toolbox installed.  Then within MATLAB, go to add a hardware package.

This opens the Add-On manager where you can see all the hardware Add-Ons.

Click on the Add-on manager for the Analog Discovery. This works for the Analog Discovery 2, despite only having a photo of the original Analog Discovery board.

You can also download it from the hardware support page on the web.

If you have any further questions or issues with getting up and running, make sure to head over to the Forum for support!

 

About Miranda Hansen

I enjoy creative writing, engineering, thinking, building, exploring and sharing with people. Huge aficionado of spending time thinking about things that “don’t matter.” I am very interested in unconstrained creativity. I love cross-discipline ideas and all of their integration into complete original systems. And I like things that do things.

View all posts by Miranda Hansen →

Leave a Reply

Your email address will not be published. Required fields are marked *