{"id":25793,"date":"2018-10-12T11:38:12","date_gmt":"2018-10-12T18:38:12","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=25793"},"modified":"2021-06-09T13:51:26","modified_gmt":"2021-06-09T20:51:26","slug":"more-with-matlab-and-the-analog-discovery-2","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/more-with-matlab-and-the-analog-discovery-2\/","title":{"rendered":"More With MATLAB And The Analog Discovery 2"},"content":{"rendered":"<p>If you frequent the <a href=\"https:\/\/digilent.com\/blog\/\">Digilent Blog<\/a> or our <a href=\"https:\/\/forum.digilent.com\/\">Forum<\/a>, you may have heard that the<a href=\"https:\/\/digilent.com\/blog\/the-analog-discovery-2-is-now-supported-in-the-matlab-data-acquisition-toolbox\/\"> Analog Discovery 2 is now supported in the MATLAB Data Acquisition toolbox!<\/a> With the release of MATLAB 2018b, the<a href=\"https:\/\/digilent.com\/shop\/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply\/\">\u00a0Analog Discovery 2<\/a>\u00a0is now included as one of the many <a href=\"https:\/\/www.mathworks.com\/hardware-support\/digilent-analog-discovery.html\">hardware devices supported by MATLAB.<\/a><\/p>\n<p>The Data Acquisition Toolbox Support Package for the Analog Discovery 2 includes\u00a0libraries for:<\/p>\n<ul>\n<li>Read data from the two oscilloscope channels (analog input)<\/li>\n<li>Control and generate data from the two waveform generators (analog output)<\/li>\n<li>Characterize ICs and measure behavior of the circuit and IC components<\/li>\n<li>Configure the sampling rate of the Analog Discovery device<\/li>\n<li>Trigger the start of your data acquisition<\/li>\n<li>Find and display Digilent Analog Discovery device settings<\/li>\n<\/ul>\n<p>Today we are going to provide some examples of these libraries and documentation. The first example is the result of running\u00a0the demo that runs the Waveform Generator and Oscilloscope. In the example below, they are plugged into each other:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-25770\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/1-Matlab-Wavegen-to-Scope-demo-600x338.png\" alt=\"\" width=\"600\" height=\"338\" data-wp-pid=\"25770\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/1-Matlab-Wavegen-to-Scope-demo-600x338.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/1-Matlab-Wavegen-to-Scope-demo-768x432.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/1-Matlab-Wavegen-to-Scope-demo-1024x576.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/1-Matlab-Wavegen-to-Scope-demo-800x450.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/1-Matlab-Wavegen-to-Scope-demo.png 1918w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>We can also run this demo as a live script.\u00a0 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 <a href=\"https:\/\/testandmeasure.org\/#\/category\/software\/jupyter-notebook-mixed-signals-3c3b875a\">Python Jupyter notebooks<\/a>\u00a0example from the <a href=\"https:\/\/testandmeasure.org\/\">WaveForms Asset Store<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_25771\" aria-describedby=\"caption-attachment-25771\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-25771 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/2-open-as-a-live-script-600x335.png\" alt=\"\" width=\"600\" height=\"335\" data-wp-pid=\"25771\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/2-open-as-a-live-script-600x335.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/2-open-as-a-live-script-768x429.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/2-open-as-a-live-script-1024x572.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/2-open-as-a-live-script-800x447.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/2-open-as-a-live-script.png 1930w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-25771\" class=\"wp-caption-text\">Result of running the same demo as a live script.<\/figcaption><\/figure>\n<figure id=\"attachment_25772\" aria-describedby=\"caption-attachment-25772\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-25772 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/3-Matlab-live-script-results-600x338.png\" alt=\"\" width=\"600\" height=\"338\" data-wp-pid=\"25772\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/3-Matlab-live-script-results-600x338.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/3-Matlab-live-script-results-768x432.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/3-Matlab-live-script-results-1024x576.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/3-Matlab-live-script-results-800x450.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/3-Matlab-live-script-results.png 1916w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-25772\" class=\"wp-caption-text\">The results of running the demo as a live script (scrolled down to the graph).<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>It can be helpful to have an idea of the structure as well when using these resources. To break it down:<\/p>\n<p><strong>MATLAB<\/strong>: The programming language and development environment<\/p>\n<p><strong>Data Acquisition Toolbox:<\/strong> Specific set of examples and libraries that allows the use of Data Acquisition hardware<\/p>\n<p><strong>Analog Discovery Hardware Support Package<\/strong>: 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.<\/p>\n<p>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.\u00a0 Then within MATLAB, go to add a hardware package.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-25773\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/4-get-hardware-support-packages-in-matlab-600x410.png\" alt=\"\" width=\"600\" height=\"410\" data-wp-pid=\"25773\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/4-get-hardware-support-packages-in-matlab-600x410.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/4-get-hardware-support-packages-in-matlab-768x525.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/4-get-hardware-support-packages-in-matlab-800x547.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/4-get-hardware-support-packages-in-matlab.png 971w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>This opens the Add-On manager where you can see all the hardware Add-Ons.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25774 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/5-add-on-manager-600x365.png\" alt=\"\" width=\"600\" height=\"365\" data-wp-pid=\"25775\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/5-add-on-manager-600x365.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/5-add-on-manager-768x468.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/5-add-on-manager-1024x623.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/5-add-on-manager-800x487.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/5-add-on-manager.png 1539w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Click on the Add-on manager for the Analog Discovery. This works for the <a href=\"https:\/\/digilent.com\/shop\/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply\/\">Analog Discovery 2<\/a>, despite only having a photo of the original Analog Discovery board.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-25775\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/6-Analog-Disocvery-DAQ-600x371.png\" alt=\"\" width=\"600\" height=\"371\" data-wp-pid=\"25775\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/6-Analog-Disocvery-DAQ-600x371.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/6-Analog-Disocvery-DAQ-768x475.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/6-Analog-Disocvery-DAQ-1024x633.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/6-Analog-Disocvery-DAQ-800x494.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/6-Analog-Disocvery-DAQ.png 1471w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>You can also download it from the<a href=\"https:\/\/www.mathworks.com\/hardware-support\/digilent-analog-discovery.html\"> hardware support page on the web.<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-25776\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/8-go-from-support-page-600x353.png\" alt=\"\" width=\"600\" height=\"353\" data-wp-pid=\"25776\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/8-go-from-support-page-600x353.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/8-go-from-support-page-768x452.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/8-go-from-support-page-1024x602.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/8-go-from-support-page-800x470.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/10\/8-go-from-support-page.png 1551w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>If you have any further questions or issues with getting up and running, make sure to head over to the <a href=\"https:\/\/forum.digilent.com\/\">Forum<\/a> for support!<\/p>\n<p>&nbsp;<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-25793 jlk' data-task='like' data-post_id='25793' data-nonce='5286a1c13f' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-25793 lc'>+2<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-25793 jlk' data-task='unlike' data-post_id='25793' data-nonce='5286a1c13f' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-25793 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-25793 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Get up and running with MATLAB and the Analog Discovery 2!<\/p>\n","protected":false},"author":36,"featured_media":24748,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4323,4312],"tags":[1736],"ppma_author":[4485],"class_list":["post-25793","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","category-usb-scopes-analyzers-generators","tag-analog-discovery-2"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/06\/IMG_2045-e1539377274923.jpg","jetpack_sharing_enabled":true,"authors":[{"term_id":4485,"user_id":36,"is_guest":0,"slug":"mirandamay7","display_name":"Miranda Hansen","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bcab037c32924b9f9b3ca4898e179f2764cb7d9a82aa2bd475170c8aaa884e1c?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/25793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=25793"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/25793\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/24748"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=25793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=25793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=25793"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=25793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}