Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Signal Logging, Visualizing, And Spectrum Analysis | Modeling PLLs Using Mixed-Signal Blockset


Logging Signals and Performing Spectrum Analysis in PLL Simulation


In this blog, we will be exploring the topic of logging signals and performing spectrum analysis in PLL simulation using the Mixed Signal Blockset and Modeling PLLs. This is the fourth video in our series and we will be focusing on the process of logging signals, post-processing the log data, and conducting spectrum analysis. These techniques are essential for understanding and analyzing the behavior of the PLL simulation.

Logging Signals

To begin, let's discuss the process of logging signals in the PLL simulation. Logging signals allows us to capture and analyze specific signals of interest during the simulation process. In the previous videos, we have already covered impairment modeling and the creation of custom impairments in the charge pump and phase frequency detector. Now, we will concentrate on logging and analysis. To log a signal, simply right-click on the signal of interest and select the "log" option. This will place a logging symbol, represented by a blue signal icon, on the selected signal. You can name your signals based on their purpose or use lowercase and underscores for better organization. Once you have logged the desired signals, run the simulation. The simulation data will be logged to the MATLAB workspace. You can access this data by either manually retrieving it from the workspace or using the Simulink Data Inspector, which provides a graphical representation of the logged data. To view the logged data using the Simulink Data Inspector, double-click on the logging symbol or signal. This will open the Simulink Data Inspector window, where you can visualize and analyze the waveform data. You can customize the layout, zoom in or out, and perform various visualization tasks to gain insights from the data. Furthermore, the logged data is also available in the MATLAB workspace. You can access it by navigating to the MATLAB workspace and locating the variable named "out". The key variables of interest within the "out" variable are "logsout" and "Tout".

Comparing Runs

The Simulink Data Inspector allows you to compare different simulation runs. By changing the parameters of the simulation and running it multiple times, you can compare the waveforms and observe any differences or improvements. To compare runs, simply change the parameters of the simulation, rerun it, and open the Simulink Data Inspector. You can bring in previous runs and compare them side by side. This visual comparison enables you to identify any variations in the signals and analyze their impact on the overall performance. It is recommended to label the runs with meaningful names or indicators to keep track of the parameters used in each run. This labeling helps in understanding the purpose and significance of each simulation run.

Post-Processing Log Data

In addition to visualizing the logged data, you can perform post-processing on the log data in the MATLAB workspace. By accessing the "out" variable, you can retrieve the logged data and perform various analysis or visualization tasks. To access the logged data, use the indexing syntax "out.logsout(index)". Replace "index" with the appropriate element number of the logged signal. If you have multiple signals, you can access them accordingly. Once you have retrieved the desired data, you can plot it using the standard MATLAB plotting functions. For example, you can use the "plot" function to create a plot of the time steps against the loop filter output. You can customize the plot by adding labels, annotations, and configuring the layout to suit your requirements.

Spectrum Analysis

Another important aspect of PLL simulation is conducting spectrum analysis on specific signals. Spectrum analysis helps in understanding the frequency components and characteristics of the signals. To perform spectrum analysis, you can utilize the Spectrum Analyzer block in Simulink. This block allows you to analyze the spectrum of a signal without the need for writing any code. However, before running the Spectrum Analyzer block, it is essential to ensure that the time data is equally spaced. If you have a variable step signal, you need to sample it to have equally spaced time data. To achieve this, you can use the "Zero-Order Hold" block and set the sample rate to a fixed value. In the case of PLL simulation, where the output frequency is known, you can set the sample rate to a multiple of the output frequency. Once you have set the sample rate, you can connect the Spectrum Analyzer block and configure its parameters. It is recommended to use the Welch's method for spectrum analysis as it provides a faster response compared to filter banks. You can set the number of points, the window function, the units (such as dB Watts), and enable running averaging if required. By running the simulation with the Spectrum Analyzer block, you can observe the transient response initially. As the simulation settles down, you will be able to see a detailed spectrum analysis plot with a dynamic range of around 200 dB. This plot helps in understanding the frequency components and any spreading caused by impairments.

Phase Noise Analysis

To demonstrate the spectrum analysis technique, let's consider the PLL output signal and introduce some phase noise impairments. By adding phase noise with different levels and offsets from the carrier frequency, we can observe the effects on the spectrum. Running the simulation with phase noise enabled, you will notice a wider spectrum with increased spreading due to the phase noise. The harmonic components of the signal will also exhibit spreading, indicating the impact of phase noise on the overall system performance.


In this blog, we have explored the process of logging signals in PLL simulation and performing spectrum analysis on specific signals. By logging signals and utilizing the Simulink Data Inspector, you can visualize and compare simulation runs, gaining insights into the behavior of the system. Additionally, the MATLAB workspace provides the flexibility to perform post-processing and further analysis on the logged data. Spectrum analysis using the Spectrum Analyzer block allows for a detailed examination of the frequency components and characteristics of the signals. These techniques are crucial for understanding and optimizing the performance of PLL simulations. Please stay tuned for more videos and blogs where we will delve deeper into impairment modeling, phase noise details, and other advanced topics in PLL simulation. Thank you for tuning in!

No comments

Popular Posts