Since I am not an expert in this area, I asked my colleague Kirthi Devleker to come back as guest blogger and give us an introduction on this long-requested feature.
The Logic Analyzer
Guy: Before talking about the DSP System Toolbox Logic Analyzer... what is a logic analyzer?
Kirthi: A logic analyzer is a tool which helps visualize and evaluate digital signals over time. On the market, you can find hardware and software versions. This is very useful when debugging or characterizing digital systems.
Guy: Ok... but what does that look like?
Kirthi: Since we are on a Simulink blog, let's start with a Simulink example. In R2013a, there is no Logic Analyzer block in the Simulink Library browser, but we provide a utility (analyzeLogicFromSimulink) to display logged data.
Comment from Seth: What does CRC mean? Answer: http://en.wikipedia.org/wiki/Cyclic_redundancy_check
In this example, we want to analyze the relation between many signals, and how they transition over time. Without the Logic Analyzer, you would probably try to observe the signals using a Scope block:
As you can see, analyzing the evolution of those 7 signals and their relation over time is not easy. With the Logic Analyzer, the same signals look like:
Guy: Wow, the advantage is pretty obvious. Now, can you give us some details on how to get started with the Logic Analyzer?
Getting Started with The Logic Analyzer
Kirthi: The first thing to note is that the Logic Analyzer is a System object. As with most system objects, you first need to instantiate it. Then you can programmatically configure the analyzer and add waves using the addWave method.
In the following example, we create a Logic Analyzer with 2 input ports and 3 waveforms. The second and third waveforms will be used to display the second input in two different ways.
Guy: Do I need to configure everything programmatically?
Kirthi: No! Everything you can do programmatically can be done using the user interface. Here is an animation illustrating that:
Here is another animation showing more possibilities of the Logic Analyzer like adding dividers, cursors and changing colors:
Now it's your turn
Try the new Logic Analyzer and let us know what you think by leaving a comment here.
9 CommentsOldest to Newest
I think this is awesome. Do slightly better though and make it a standard signal sink block. I’m surprised it’s taken so long for Mathworks to implement this, especially since the foray into HDL code generation about 5 years ago. Nevertheless, I’m happy to finally see this feature.
Could some of this capabilities, for example, cursor addition, be made available to or integrated with Simulink.sdi?
@Damon and Wei: Thank you for suggestions. I cannot guarantee anything because plans can always change, but those are definitely things we are considering for future releases.
Keep the good suggestions coming!
very interesting tool!!
I was about to make my own GUI for analyzing digital signals for a project and before I have made some search if this tool existed, so I’m glad to see that exists!!
But I have an issue trying to draw signals.
I have captured a 8bit bus with an OSC (Agilent MSO 9254A) witch outputs a csv file in this format:
Start Time,Delta Time,Bus 1
The general question is:
How can I display this BUS??
More specific questions:
The example with the for is not very useful,how do I input a signal? what’s the format accepted?
Does the analyzer accept not regular time step or I have to resample all the bus with the smallest time step?
I’m working with time steps of “ps”,Is there a limit of smallest time step?
Also there is a big amount of data collected from a FPGA, the signal is up to 10 seconds, is there a problem with this combined with the time step needed?
Hope to hear from you soon.
Guillermo: The data you display seems to be exactly the kind of thing the logic analyzer is designed for.
First you will need to get your data into MATLAB, probably using a function like CSV read. Then you should look at the documentation of the logic analyzer to see how to import the data.
Typically, this involves creating an instance of the analyzer (“h = dsp.LogicAnalyzer”), then setting some properties with methods like “addWave”, and finally using “step” to pull the data in. If you want to import the data all at ounce, there is no need for a “for loop”, only one call to step should do the job.
If you have problems, I recommend calling technical support. they will be able to help.
While doing the model testing for my Automotive control system models, I felt need of such a waveform analyzer using which I do result comparisons and time measurement (Simulink scope is almost useless for analysis).
I found a nice digital waveform viewer tool called GTKWave which is open source and free to use.
I developed some Matlab scripts and Simulink blockset to integrate this tool into simulink.
My work is available on FEX at
This tool does the similar task and have even more advance features as above Logic analyzer. And most important, it can be used with generic simulink without any specific toolbox.
Why above logic analyzer is available with DSP System Toolbox only, why not with generic simulink ?
@Tabrez Alam: Here is a response to your last question:
The scopes available in Simulink, e.g., Scope block, Floating Scope, XY Graph, etc, are all basic visualization tools enabling quick debugging of Simulink models only. The DSP System Toolbox provides, among other things, a suite of next generation visualization tools, of which the Logic Analyzer is one, for both the MATLAB and Simulink environments. Other examples of these visualization tools include: Time Scope (Time Scope blog), Spectrum Analyzer, Array Plot
Is it possible to print the logic analyzer content?
I couldn’t find the ‘print’ or ‘print to file’ menus.
I have to validate my model of arm robot imported from autodesk inventor to matlab simmechanics. what is the ideal method used in this case? and how to introduce the different elements necessary in the joints for simulate correctly my model?