Simulink, a software option of MATLAB, is a well known tool to simulate algorithms on a personal computer. In the automotive market, it simulates vibration of an auto body to optimize its suspension. In communications, it simulates modulation and demodulation of a digital communications system. In the data storage market, it simulates channel elements, such as an equalizer or detector.

Simulation in Simulink usually uses a standard internal signal generator as a signal source, but sometimes circuit simulation with an actual signal is needed. Since LeCroy’s XDEV math option allows X-Stream oscilloscopes to implement MATLAB as an embedded function, Simulink can be implemented as well. One advantage of this method is that simulated results can be analyzed by the advanced analysis functions of the scope, such as jitter and serial data analysis.

Figure 1 shows a simple digital filter model. To implement the Simulink model in the oscilloscope, it must be called from MATLAB where it is stored as “Model1”. Figure 2 shows the setup for math trace F1, using MATLAB as an embedded function. To call the Simulink model from MATLAB, the “sim” command is used.

Figure 1:

Digital filter model for simulation

Figure 2:

F1 setting to use the filter model through MATLAB.

The syntax of the command is as follows:

[t,x,y]=sim(‘ModelName’, SimulationTime, Options, DataArray) 

“DataArray”, the input data for Simulink Model, must be a two-dimensional array consisting of time and voltage values. Since the waveform data, WformIn1, transferred from the oscilloscope to MATLAB is a one-dimensional data array of voltage values, it must be converted to a two-dimensional array in MATLAB with the addition of the time data array. To make time data, MATLAB needs the following information: time resolution and number of points of WformIn1. The time resolution can be read as “TimePerPoint” from the oscilloscope. Since the X-Stream oscilloscope uses Windows based software, it is COM (Command Object Model) based, and the needed parameters can be read through ActiveX. The MATLAB command for this operation is shown below:


And the number of points of the sample length of WformIn1 is obtained by using the “size” command. So now the duration of WformIn1 can be calculated as the product of time resolution and number of points. Then time array “t” is generated using those parameters. The data array “ut” is made from the calculated time array and the WformIn1 amplitude by concatenation. Then “ut” is sent to the Simulink model by the “sim” command. In this case, the Simulink model name is “Model1”, under which the Simulink model was stored previously. Since simulation time must match the duration of WformIn1, the variable “Duration” is used in the command.

Figure 3:

MATLAB script to call Simulink model

Figure 4 shows the settings of the simulation parameters of “Model1”. The “Solver type” must be set to Fixed-step, and “Fixed step size” must be set to the time resolution of WformIn1. The variable “TimeP” can be entered into this column.

Figure 4:

Simulation Parameter Setup

Figure 5 shows the setting of block parameters of the “Discrete Filter”. “Sample time” must also match the time resolution of WformIn1. Again, “TimeP” can be entered into the column.

Figure 5:

Discrete Filter Setup

Now, the Simulink model is inserted into the oscilloscope's math process flow, and the simulated result appears in math trace F1.

The digital filter model is a low-pass filter. Its cutoff frequency depends on time resolution. In this case, it is 40.8 MHz @ 5 GS/s.

Figure 6 shows the result of the simulation. The upper trace is the input signal into Channel 1 and the lower trace is the simulated result at 40 MHz. Parameter P3 shows the ratio of amplitude input to output. It is at near cut-off frequency, so it shows close to 0.707.

Figure 6:

Simulated result near cut-off (40 MHz)

Figure 7 shows the result of the simulation at 100 MHz. The simulated result has much smaller amplitude.

Figure 7:

Simulated result beyond cut-off (100 MHz)

This shows how Simulink can be used as a component within the math processing stream of a LeCroy X-Stream oscilloscope. It adds the ability to process data based on simulations of system components that are being considered in design, reducing the need to use prototypes.