Documentation

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:

  1. 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.

  2. Synchronizes aligned signal pairs according to the specified Sync Method.

    Interpolates data in signal pairs as specified by the Interpolation Method.

  3. Computes the difference of the signal pairs.

  4. Compares the difference result against specified tolerances.

When the comparison run completes, the results of the comparison are added in the navigation pane.

StatusComparison Result
  • Signal aligns.

  • Data from two runs falls within the tolerance.

  • Signal aligns.

  • Data from two runs does not fall within the tolerance.

Signal from Baseline does not align with a signal from Compare To.

When you compare signals of different lengths, the Simulation Data Inspector compares the signals on their overlapping interval.

Signal Alignment in the Simulation Data Inspector

Aligning the signals is the first step in a comparison. In the alignment step for a run comparison, 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 their properties. In the Alignment tab of the Preferences window, you can specify the priority order for each of the signal properties used for alignment. The Align By field specifies the highest priority property. The priority drops with each subsequent Then By field. Always specify a primary alignment property in the Align By field, but you can leave any number of the Then By fields blank.

From each drop-down, you can select Data Source, Path, SID, or Signal Name. By default, the Simulation Data Inspector is configured to first align signals by data source, then path, then SID, and then signal name.

PropertyDescription
Data SourcePath of the variable in the MATLAB® workspace for data imported from the workspace
PathBlock path for the source of the data in the model
SID

Numeric signal identifier

For more information about SIDs, see Locate Diagram Components Using Simulink Identifiers

Signal NameName of the signal in the model

Synchronization Options in the Simulation Data Inspector

You can choose how the Simulation Data Inspector synchronizes signals when their time vectors do not contain all the same sample times. You can select union or intersection as the synchronization method.

When you specify union synchronization, the Simulation Data Inspector builds a time vector that comprises every sample time represented between the two signals. For each sample time not originally present in either signal, the Simulation Data Inspector interpolates the value. When you specify intersection synchronization, the Simulation Data Inspector uses only the sample times present in both signals in the comparison.

Choosing between the two options is a trade off between speed and accuracy. The interpolation required by union synchronization takes time, but provides a more precise result. When you use intersection synchronization, the run completes quickly because the Simulation Data Inspector computes fewer data points and does not interpolate. However, some data is discarded in the process.

Interpolation Options in the Simulation Data Inspector

You can choose to interpolate your data with a zero-order hold (zoh) or a linear approximation. When you specify zoh in 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.

Tolerances in the Simulation Data Inspector

You can specify absolute, relative, and time tolerances in the Simulation Data Inspector. You can specify all tolerances globally, at the top of the graphical viewing area, or on a signal by signal basis in the properties pane. To use a signal tolerance, change Override Global Tol to yes.

When you specify multiple tolerance, sometimes each tolerance yields a different answer for what the tolerance is at each point. The Simulation Data Inspector computes the overall tolerance band by selecting the most lenient tolerance result for each data point.

First, the Simulation Data Inspector computes the tolerance band using only the absolute and magnitude tolerances:

tolerance = max(absoluteTolerance,relativeTolerance*abs(baselineData));

The upper boundary of the tolerance band is formed by adding tolerance to the Baseline signal. Similarly, the lower boundary of the tolerance band is formed by subtracting tolerance from the Baseline signal.

To apply the time tolerance, the Simulation Data Inspector looks at a time interval defined as [(t-timeTol), (t+timeTol)]. For the upper boundary of the tolerance band, the Simulation Data Inspector selects the maximum value on the interval for each data point. For the lower boundary of the tolerance band, the Simulation Data Inspector selects the minimum value on the interval for each data point.

Related Topics

Was this topic helpful?