{"id":2756,"date":"2011-04-29T13:21:17","date_gmt":"2011-04-29T13:21:17","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/2011\/04\/29\/mixing-analog-and-digital-signals\/"},"modified":"2016-05-17T21:20:30","modified_gmt":"2016-05-18T01:20:30","slug":"mixing-analog-and-digital-signals","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2011\/04\/29\/mixing-analog-and-digital-signals\/","title":{"rendered":"Mixing Analog and Digital Signals"},"content":{"rendered":"<div class=\"content\">\r\n\r\n<a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/29096\">Idin<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/1320-circuit-level-analog---mixed-signal-examples\">Analog\/Mixed-Signal Examples<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/4156\">Dick Benson<\/a>.\r\n\r\n<i>Hi, my name is Idin, and this is my first post for Pick of the Week as a guest blogger. My background is in wireless communications,\r\nand that's the area I support as an Applications Engineer at MathWorks. I started using MATLAB occasionally during my undergrad\r\ndays, but these days, I have MATLAB open on my desktop all the time. I mostly focus on Simulink and our tools for targeting\r\nwireless communication hardware.<\/i>\r\n\r\nCommunication systems (wired or wireless) are typically a complex mix of analog and digital components. Simulink is one of\r\na small set of simulators that can naturally simulate analog and digital components in the same system. Examples of such systems\r\ninclude phase-lock-loops (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Phase-locked_loop\">PLL<\/a>), clock data recovery (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Clock_recovery\">CDR<\/a>), and analog-to-digital converters (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Analog-to-digital_converter\">ADC<\/a>). Components that include both digital and analog portions are referred to as \"mixed-signal\".\r\n\r\nThis week's pick is a collection of examples created by my colleague, Dick Benson. It is an impressive set of 60+ Simulink\r\nmodels that include, among others, an interleaved ADC, clock multiplying delay lock loop, clock recovery for NRZ data, PLL,\r\nfractional N PLL, digital fractional N PLL, Sigma-Delta ADC, elliptic LC filter design, RF examples, numerous Circuit Level\r\nexamples such as switching power supplies, class D H bridge audio amp, active filters, passive filters, and simulated vector\r\nnetwork analyzers.\r\n\r\nWhat I like about these models is that they typically show how a simple system can be designed and simulated, and then go\r\non to show how real-world impairments and mitigation algorithms can be modeled. As such, they can be used to learn about both\r\nthe Simulink environment, and the theory behind the systems being modeled.\r\n\r\nThese models also include many reusable blocks that can complement the Simulink libraries for an analog\/mixed-signal designer.\r\nSome examples of these blocks are: VCO with user-defined phase noise, analog spectrum analyzer, transfer function estimator,\r\npeak-to-peak jitter measurement, and switched-capacitor circuits.\r\n\r\nLet's look at the set of models concerning PLLs.\r\n\r\nWe can start with the first model, Simple PLL, shown below:\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/guest\/potw_analog_mixed_signal\/sl_model2.bmp\" alt=\"\" hspace=\"5\" vspace=\"5\" \/>\r\n\r\nThis model shows a simple PLL structure that multiplies the reference 100MHz input frequency by a factor of 8 to produce an\r\n800MHz signal at the output of the VCO. If run as-is, the output spectrum look like the following:\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/guest\/potw_analog_mixed_signal\/plot1.bmp\" alt=\"\" hspace=\"5\" vspace=\"5\" \/>\r\n\r\nNote the purity of this tone (clear to at least 100dB). This models an ideal system. In a real system, the two D flip-flops\r\non the top left may not have identical switching characteristics (in fact, they almost certainly won't). To model this behavior,\r\nwe switch in the \"delay asymmetry\" block (block in red). This models a real impairment in the system, and we can see its effect\r\non the output:\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/guest\/potw_analog_mixed_signal\/plot2.bmp\" alt=\"\" hspace=\"5\" vspace=\"5\" \/>\r\n\r\nNote the two spurs at 100MHz away from our desired carrier (this is the frequency of the reference input signal).\r\n\r\nTo mitigate this impairment, we can introduce a low-pass filter on the VCO control voltage (change switch SW2 to the right),\r\nwhich results in the following output:\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/guest\/potw_analog_mixed_signal\/plot3.bmp\" alt=\"\" hspace=\"5\" vspace=\"5\" \/>\r\n\r\nYou can see that we have now filtered out the spurs at +\/-100MHz. However, we're still allowing some noise close to our desired\r\ncarrier. By making the filter more aggressive, we can eliminate more of this noise, but that will negatively affect our loop\r\nbandwidth (which relates to the loop's ability to acquire the initial phase lock, or to recover from losing its lock). This\r\nis the classic engineering trade-off: we desire a larger loop bandwidth, and less noise. A PLL designer can use a model like\r\nthis to determine how he\/she will make that trade-off.\r\n\r\nThe next three PLL models in this set show more sophisticated designs, which multiply the reference input frequency by a non-integer\r\nfactor (known as fractional-N PLLs). The two models with \"digital compensation\" highlight Simulink's ability to naturally\r\nintegrate digital and analog components, as well as practical techniques for producing a clean tone at the output (see the\r\nmodels for references).\r\n\r\nOverall, the PLL models can be useful whether you're an experienced PLL designer or if you\u2019re just trying to learn about PLLs.\r\nFor a beginner these models can serve as a tutorial, and because of the dynamic simulation capability, they can be used to\r\nshow how different choices affect the loop's behavior. For a PLL expert, these models show how the Simulink environment lends\r\nitself to simulating PLLs and studying the trade-offs that any designer will have to make. The models also provide a library\r\nof reusable components (especially for measurements) that can be used in any analog\/mixed-signal model.\r\n\r\nThis has been a great submission from Dick Benson who has 25+ years of experience in this field, and I encourage you to look\r\nat his other submissions for more great examples of how Simulink can be used for communication system simulations.\r\n\r\nAs always, we welcome your <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=2756#respond\">comments!<\/a>\r\n\r\n<script>\/\/ <![CDATA[\r\nfunction grabCode_a64c3a64dc8a4bf7b90ab13bbc6aa6f3() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='a64c3a64dc8a4bf7b90ab13bbc6aa6f3 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' a64c3a64dc8a4bf7b90ab13bbc6aa6f3';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Idin Motedayen-Aval';\r\n        copyright = 'Copyright 2011 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('\r\n\r\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\r\n\r\n\r\n\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }\r\n\/\/ ]]><\/script>\r\n<p style=\"text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;\">\r\n<a><span style=\"font-size: x-small; font-style: italic;\">Get\r\nthe MATLAB code\r\n<noscript>(requires JavaScript)<\/noscript><\/span><\/a>\r\n\r\nPublished with MATLAB\u00ae 7.12<\/p>\r\n\r\n<\/div>\r\n<!--\r\na64c3a64dc8a4bf7b90ab13bbc6aa6f3 ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/29096 % Idin>'s pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/1320-circuit-level-analog---mixed-signal-examples % Analog\/Mixed-Signal Examples> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/4156 Dick % Benson>.\r\n%\r\n% _Hi, my name is Idin, and this is my first post for Pick of the Week as a\r\n% guest blogger. My background is in wireless communications, and that's\r\n% the area I support as an Applications Engineer at MathWorks.  I started\r\n% using MATLAB occasionally during my undergrad days, but these days, I\r\n% have MATLAB open on my desktop all the time. I mostly focus on Simulink\r\n% and our tools for targeting wireless communication hardware._\r\n%\r\n% Communication systems (wired or wireless) are typically a complex mix of\r\n% analog and digital components.  Simulink is one of a small set of\r\n% simulators that can naturally simulate analog and digital components in\r\n% the same system. Examples of such systems include phase-lock-loops\r\n% (<http:\/\/en.wikipedia.org\/wiki\/Phase-locked_loop PLL>), clock data\r\n% recovery (<http:\/\/en.wikipedia.org\/wiki\/Clock_recovery CDR>), and\r\n% analog-to-digital converters\r\n% (<http:\/\/en.wikipedia.org\/wiki\/Analog-to-digital_converter ADC>).\r\n% Components that include both digital and analog portions are referred to\r\n% as \"mixed-signal\".\r\n%\r\n% This week's pick is a collection of examples created by my colleague,\r\n% Dick Benson. It is an impressive set of 60+ Simulink models that\r\n% include, among others, an interleaved ADC, clock multiplying delay lock\r\n% loop, clock recovery for NRZ data, PLL, fractional N PLL, digital\r\n% fractional N PLL, Sigma-Delta ADC, elliptic LC filter design, RF\r\n% examples, numerous Circuit Level examples such as switching power\r\n% supplies, class D H bridge audio amp, active filters, passive filters,\r\n% and simulated vector network analyzers.\r\n%\r\n% What I like about these models is that they typically show how a simple\r\n% system can be designed and simulated, and then go on to show how\r\n% real-world impairments and mitigation algorithms can be modeled. As\r\n% such, they can be used to learn about both the Simulink environment, and\r\n% the theory behind the systems being modeled.\r\n%\r\n% These models also include many reusable blocks that can complement the\r\n% Simulink libraries for an analog\/mixed-signal designer. Some examples of\r\n% these blocks are: VCO with user-defined phase noise, analog spectrum\r\n% analyzer, transfer function estimator, peak-to-peak jitter measurement,\r\n% and switched-capacitor circuits.\r\n%\r\n% Let's look at the set of models concerning PLLs.\r\n%\r\n% We can start with the first model, Simple PLL, shown below:\r\n%\r\n% <<sl_model2.bmp>>\r\n%\r\n% This model shows a simple PLL structure that multiplies the reference\r\n% 100MHz input frequency by a factor of 8 to produce an 800MHz signal at\r\n% the output of the VCO. If run as-is, the output spectrum look like the\r\n% following:\r\n%\r\n% <<plot1.bmp>>\r\n%\r\n% Note the purity of this tone (clear to at least 100dB). This models an\r\n% ideal system. In a real system, the two D flip-flops on the top left may\r\n% not have identical switching characteristics (in fact, they almost\r\n% certainly won't).  To model this behavior, we switch in the \"delay\r\n% asymmetry\" block (block in red). This models a real impairment in the\r\n% system, and we can see its effect on the output:\r\n%\r\n% <<plot2.bmp>>\r\n%\r\n% Note the two spurs at 100MHz away from our desired carrier (this is the\r\n% frequency of the reference input signal).\r\n%\r\n% To mitigate this impairment, we can introduce a low-pass filter on the\r\n% VCO control voltage (change switch SW2 to the right), which results in\r\n% the following output:\r\n%\r\n% <<plot3.bmp>>\r\n%\r\n% You can see that we have now filtered out the spurs at +\/-100MHz.\r\n% However, we're still allowing some noise close to our desired carrier.\r\n% By making the filter more aggressive, we can eliminate more of this\r\n% noise, but that will negatively affect our loop bandwidth (which relates\r\n% to the loop's ability to acquire the initial phase lock, or to recover\r\n% from losing its lock). This is the classic engineering trade-off: we\r\n% desire a larger loop bandwidth, and less noise. A PLL designer can use a\r\n% model like this to determine how he\/she will make that trade-off.\r\n%\r\n% The next three PLL models in this set show more sophisticated designs,\r\n% which multiply the reference input frequency by a non-integer factor\r\n% (known as fractional-N PLLs). The two models with \"digital compensation\"\r\n% highlight Simulink's ability to naturally integrate digital and analog\r\n% components, as well as practical techniques for producing a clean tone at\r\n% the output (see the models for references).\r\n%\r\n% Overall, the PLL models can be useful whether you're an experienced PLL\r\n% designer or if you\u00e2\u20ac\u2122re just trying to learn about PLLs. For a beginner\r\n% these models can serve as a tutorial, and because of the dynamic\r\n% simulation capability, they can be used to show how different choices\r\n% affect the loop's behavior. For a PLL expert, these models show how the\r\n% Simulink environment lends itself to simulating PLLs and studying the\r\n% trade-offs that any designer will have to make. The models also provide\r\n% a library of reusable components (especially for measurements) that can\r\n% be used in any analog\/mixed-signal model.\r\n%\r\n% This has been a great submission from Dick Benson who has 25+ years of\r\n% experience in this field, and I encourage you to look at his other\r\n% submissions for more great examples of how Simulink can be used for\r\n% communication system simulations.\r\n%\r\n% To learn more about using Simulink for PLL design, and mixed-signal\r\n% design in general, watch <https:\/\/www.mathworks.com\/wbnr49699 this % webinar>.\r\n%\r\n% As always, we welcome your\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=2756#respond comments!>\r\n##### SOURCE END ##### a64c3a64dc8a4bf7b90ab13bbc6aa6f3\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n\r\nIdin's pick this week is Analog\/Mixed-Signal Examples by Dick Benson.\r\n\r\nHi, my name is Idin, and this is my first post for Pick of the Week as a guest blogger. My background is in wireless... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2011\/04\/29\/mixing-analog-and-digital-signals\/\">read more >><\/a><\/p>","protected":false},"author":36,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2756"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=2756"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2756\/revisions"}],"predecessor-version":[{"id":7280,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2756\/revisions\/7280"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=2756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=2756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=2756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}