How the Simulation Data Inspector Compares Data
You can tailor the Simulation Data Inspector comparison process to fit your requirements in multiple ways. When comparing runs, the Simulation Data Inspector:
Aligns signal pairs in the Baseline and Compare To runs based on the Alignment settings.
The Simulation Data Inspector does not compare signals that it cannot align.
Synchronizes aligned signal pairs according to the specified Sync Method.
Values for time points added in synchronization are interpolated according to the specified Interpolation Method.
Computes the difference of the signal pairs.
For all signal data types other than
double, the software upcasts the data to
Compares the difference result against specified tolerances.
When the comparison run completes, the results of the comparison are displayed in the navigation pane.
Difference falls within the specified tolerance.
Difference violates specified tolerance.
|The signal does not align with a signal from the Compare To run.
When you compare signals with differing time intervals, the Simulation Data Inspector compares the signals on their overlapping interval.
In the alignment step, the Simulation Data Inspector decides which signal from the Compare To run pairs with a given signal in the Baseline run. When you compare signals with the Simulation Data Inspector, you complete the alignment step by selecting the Baseline and Compare To signals.
The Simulation Data Inspector aligns signals using a combination of their Data Source, Path, SID, and Signal Name properties.
|Name of the variable in the MATLAB® workspace
|Block path for the source of the data in its model
Automatically assigned Simulink® identifier
|Name of the signal in the model
With the default alignment settings, the Simulation Data Inspector aligns signals between runs according to this flow chart.
You can specify the priority for each of the signal properties used for alignment in
the Simulation Data Inspector Preferences. The Align
By field specifies the highest priority property used to align signals.
The priority drops with each subsequent Then By field. You must
specify a primary alignment property in the Align By field, but you
can specify any number of the Then By fields as
Often, signals that you want to compare don't contain the exact same set of time
points. The synchronization step in Simulation Data Inspector comparisons resolves
discrepancies in signals' time vectors. You can choose
intersection as the synchronization method.
When you specify
union synchronization, the Simulation Data
Inspector builds a time vector that includes every sample time between the two signals.
For each sample time not originally present in either signal, the Simulation Data
Inspector interpolates the value. The second graph in the illustration shows the union
synchronization process, where the Simulation Data Inspector identifies samples to add
in each signal, represented by the unfilled circles. The final plot shows the signals
after the Simulation Data Inspector has interpolated values for the added time points.
The Simulation Data Inspector computes the difference using the signals in the final
graph, so that the computed difference signal contains all the data points between the
signals over the intersecting time region.
When you specify
intersection synchronization, the Simulation Data
Inspector uses only the sample times present in both signals in the comparison. In the
second graph, the Simulation Data Inspector identifies samples that do not have a
corresponding sample for comparison, shown as unfilled circles. The final graph shows
the signals used for the comparison, without the samples identified in the second graph.
It is recommended to use
union synchronization because it provides
a more precise result. When you use
intersection synchronization, the
comparison finishes quickly because the Simulation Data Inspector computes the
difference for fewer data points and does not interpolate. However, some data is
discarded and precision lost with
The interpolation property of a signal determines how the Simulation Data Inspector displays the signal and how additional data values are computed in synchronization. You can choose to interpolate your data with a zero-order hold (zoh) or a linear approximation. You can also specify no interpolation.
When you specify
none for the
Interpolation Method, the Simulation Data Inspector replicates
the data of the previous sample for interpolated sample times. When you specify
linear interpolation, the Simulation Data Inspector uses samples
on either side of the interpolated point to linearly approximate the interpolated value.
Typically, discrete signals use
zoh interpolation and continuous
linear interpolation. You can specify the
Interpolation Method for your signals in the signal
The Simulation Data Inspector allows you to specify the scope and value of the tolerance for your signal. You can define a tolerance band using any combination of absolute, relative, and time tolerance values, and you can specify whether the specified tolerance applies to an individual signal or to all the signals in a run.
In the Simulation Data Inspector, you can specify the tolerance for your data
globally or for an individual signal. Global tolerance values apply to all signals
in a run that do not have Override Global Tol set to
yes. You can specify global tolerance values for your data at
the top of the graphical viewing area in the Compare view. To
specify signal specific tolerance values, edit the signal properties and ensure the
Override Global Tol property is set to
In the Simulation Data Inspector, you can specify a tolerance band for your run or signal using a combination of absolute, relative, and time tolerance values. When you specify the tolerance for your run or signal using multiple types of tolerances, each tolerance can yield a different answer for the tolerance at each point. The Simulation Data Inspector computes the overall tolerance band by selecting the most lenient tolerance result for each data point.
When you define your tolerance using only the absolute and relative tolerance properties, the Simulation Data Inspector computes the tolerance for each point as a simple maximum.
The upper boundary of the tolerance band is formed by adding
tolerance to the Baseline signal.
Similarly, the Simulation Data Inspector computes the lower boundary of the
tolerance band by subtracting
tolerance from the
When you specify a time tolerance, the Simulation Data Inspector evaluates the
time tolerance first, over a time interval defined as
(tsamp+tol)] for each sample. The Simulation
Data Inspector builds the lower tolerance band by selecting the minimum point on the
interval for each sample. Similarly, the maximum point on the interval defines the
upper tolerance for each sample.
If you specify a tolerance band using an absolute or relative tolerance in addition to a time tolerance, the Simulation Data Inspector applies the time tolerance first, and then applies the absolute and relative tolerances to the maximum and minimum points selected with the time tolerance.
upperTolerance = max +
lowerTolerance = min -
The Simulation Data Inspector does not support comparing:
Before R2020a: Signals of data types