This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Compare Simulation Data

The Simulation Data Inspector can compare runs and individual signals. This example is a continuation of the workflow described in Inspect Simulation Data.

Compare Signals

This example compares the Stick input signal to the output observed at alpha, rad and uses the tolerance feature in the Simulation Data Inspector to analyze the result.

To compare the alpha, rad signal to the Stick signal:

  1. In the Inspect pane, right-click Stick under Run 1 and select Compare Signals > Set as Baseline.

  2. Right-click alpha, rad and select Compare Signals > Set as Compare To.

  3. Switch to the Compare pane, and click the Compare button.

Here, the alpha, rad and Stick signals are compared from Run 1. The comparison fails because the signals do not match within the absolute and relative tolerances, both specified as 0 by default.

From a visual inspection of the signals, you can see alpha, rad lags Stick. Add a time tolerance to the Stick signal.

  1. In the properties pane, click the Override Global Tolerance baseline value field, and select yes from the drop-down.

    When the Override Global Tolerance field is set to yes, the tolerance values specified in the signal properties are applied instead of the global tolerances specified above the graphical viewing area.

  2. Type 0.5 into the Time Tolerance field in the properties pane to the left of the graphical viewing area.

    The comparison automatically runs again, with the updated tolerance value.

    The Simulation Data Inspector draws the tolerance band around the plotted Baseline signal and around the signed difference signal displayed in the bottom subplot.

The time tolerance covers the phase difference between the two signals, but the comparison still does not pass due to the amplitude difference. To add an absolute tolerance to the Stick signal, type 0.05 into the Absolute Tolerance field in the properties pane.

With the combination of the absolute and time tolerances, the signal comparison passes.

Compare Runs

You can also use the Simulation Data Inspector to compare all logged signals in a model at once by comparing runs. Run comparisons provide useful information about the effects of changing model parameters. For example, change the frequency cutoff of the filter for the control stick input signal. Then, evaluate the effect on the output signal with the Simulation Data Inspector.

  1. Click the Model Explorer button to access the Model Workspace variables.

  2. Change the value of Ts in the Model Workspace from 0.1 to 1.

  3. Close the Model Explorer.

  4. Simulate the model with the new filter.

  5. In the Simulation Data Inspector, click Compare to switch to the Compare pane.

  6. Select Run 2: slexAircraftExample in the Baseline drop-down menu.

  7. Select Run 3: slexAircraftExample in the Compare To drop-down menu.

  8. Click Compare.

The Compare pane lists all signals from the runs with a comparison result. In this example, the comparison results of the aligned signals do not match. The signal differences are not within the acceptable specified tolerance values, all of which are set to zero.

    Note:   The Simulation Data Inspector only compares signals from the Baseline run that align with a signal from the Compare To run. If a signal from the Baseline run does not align with a signal from the Compare To run, the signal is listed in the Compare pane with a warning. . For more information on signal alignment, see Signal Alignment in the Simulation Data Inspector.

To plot comparison data, select the signal you want to see in the Compare pane. Here, the top plot shows the q, rad/sec signals from the Baseline and Compare To runs. The bottom plot shows the difference between the signals and a graphical representation of the tolerance. For information on manipulating the plot, see Customize the Simulation Data Inspector Interface.

To qualify signals in the run comparison, you can add global tolerances to the comparison using the global tolerance fields above the graphical viewing area. Enter one or more desired tolerance values, then hit the Compare button to run the comparison again and compare the results against the tolerance values. The Simulation Data Inspector draws the tolerance band around the Baseline signal and on the signed difference plot on the lower half of the graphical viewing area. To apply different tolerance values to specific signals, set the Override Global Tolerance property to yes and specify the desired tolerance values in the signal properties.

Related Topics

Was this topic helpful?