Main Content

检查仿真数据

您可以使用仿真数据检查器查看和检查来自仿真或导入数据的信号。仿真数据检查器通过允许您从多个子图上的多个仿真和来源分组数据,从而为您的数据提供了全面的视图。您可以在图中放大和平底锅,并使用数据光标以密切检查信号值,并且可以重播数据以分析信号关系。

This example shows you how to view and inspect signal data from theslexAircraftExample使用仿真数据检查器建模。

配置记录信号

This example uses signal logging to send data to the Simulation Data Inspector. You can also import signal data from the base workspace or a CSV, MDF,微软®Excel®, or MAT-file. For more information, seeView Data in the Simulation Data Inspector

Open theslexAircraftExample型号,标记几个用于记录的信号,并运行模拟。

  1. To open the model, enterslexAircraftExamplein the MATLAB®命令窗口。

  2. 记录q, rad/sec,,和阿尔法,rad信号, select the signals in the model. Then, click日志信号

    伐木徽章appears above each signal marked for logging.

  3. Double-click the Pilot block. Set波形to正弦, and clickOK

  4. In the Simulink®Editor, click theData Inspectorbutton to open the Simulation Data Inspector.

  5. 模拟模型。The simulation run appears in the Simulation Data Inspector.

    默认情况下,Inspect窗格中列出了所有记录信号行,器官ized by simulation run. You can expand or collapse any of the runs to view the signals in a run. For more information on signal grouping, see配置仿真数据检查器

View Signals

要选择要绘制的信号,请使用导航窗格中信号旁边的复选框。选择旁边的复选框q, rad/sec,, and阿尔法,rad信号。当您要绘制的信号更容易在模型中找到时,您可以单击“记录徽章”以获取信号以在仿真数据检查器中绘制它。

You can also use signal browsing mode to quickly view all the signals in your run onTime Plot可视化。有关如何启用和使用的更多信息Browse Mode, seeVisualize Many Logged Signals

在多个图上查看信号

您可以使用子图布局在不同的子图上查看信号组。例如,您可以从具有相似值范围的不同模拟运行或组信号中分组相同的信号。

  1. In the model, double-click the Pilot block. Set波形tosquare, and clickOK

  2. 模拟模型。

  3. 默认情况下,Simulation Data Inspector automatically moves prior runs into theArchive并将视图传输到当前运行。拖运行1来自Archiveinto the work area.

  4. Click theLayout按钮并选择2×1情节布局。

  5. Click the lower subplot in the viewing area. In theInspect窗格,选择的复选框q, rad/sec,, and阿尔法,rad信号下运行1

    The check boxes in theInspectpane indicate the signals plotted in the selected subplot, outlined in blue.

You can also move signals graphically, rather than using the check boxes. Click and drag the signal from theInspect窗格或另一个子图到您要绘制它的子图。

For more information on working with plots, seeCreate Plots Using the Simulation Data Inspector

Zoom, Pan, and Resize Plots

You can closely inspect signals in a larger viewing area using theMaximizeand全屏options on the toolbar above the viewing area.

  • — SelectMaximize扩展活动子图以占据整个图形观看区域。

  • — Select全屏to view your entire layout using your whole screen. The Simulation Data Inspector automatically collapses the navigation pane so the view of the layout is as large as possible.

You can zoom and pan within subplots that use a time plot visualization to inspect signal values and the relationships between signals. The zoom and pan controls in the Simulation Data Inspector are on the toolstrip above the graphical viewing area. Each icon allows you to control aspects of the plot using your mouse.

  • You can select the zoom action for the zoom button from the drop-down.

    • When you want to zoom in on a selected area in the plot, selectZoom In。当你有Zoom Inselected, the Simulation Data Inspector adapts the zoom action it performs based on the area of the plot you select. When you select a very narrow area, the Simulation Data Inspector zooms on they仅轴。当您选择一个非常短的区域时,仿真数据检查器会缩放x仅轴。The highlight around the selected region indicates the zoom behavior for that selection.

      您可以单击图形查看区域以在两个轴上固定量的固定量。您也可以单击并拖动以选择一个区域来定义y- andt-axes. Scrolling with the mouse wheel zooms in and out on both axes.

    • SelectZoom Outto zoom out a fixed amount when you click inside the plot area.

    • 及时放大makes all the mouse actions zoom on thet-轴。您可以单击图形查看区域以固定量。您可以单击并拖动图形查看区域以选择图的一部分作为限制t-轴。Scrolling with the mouse wheel zooms in and out on thet-轴。

    • When you selectZoom in Y,所有鼠标动作放大y-轴。You can click in the graphical viewing area to zoom in a fixed amount. You can also click and drag to select a portion of the plot as the limits for they-轴。Scrolling with the mouse wheel zooms in and out on they-轴。

  • With the mouse pointer selected, you can select signals by clicking them and pan by clicking anywhere on the plot and dragging the mouse.

  • 单击“合适的视图”选项以扩展轴以容纳绘制的数据。

Linked Subplots

默认情况下链接子图。链接图在您时具有同步响应:

  • Click a plot and drag to pan.

  • Perform any zoom operation.

  • 适合查看。

  • 调整T-Axislimits.

To inspect data independently in a subplot, you can unlink the subplot.

  1. Select the subplot you want to unlink.

  2. Click the可视化设置button in the upper right of the viewing area.

  3. In theLimitssection, clear theLink Subplotoption.

    The broken link symbolappears on the unlinked subplot.

检查仿真数据Using Cursors

In the Simulation Data Inspector, you can inspect signals using data cursors. You can use one or two cursors to inspect your data. To add two cursors, select两个光标来自Show/hide data cursorsdrop-down.

With two cursors, three time values are displayed: the time corresponding to each cursor position and the time spanned by the cursors. You can move the two cursors together by dragging the span label between the two cursors. You can also set the span by typing the desired value into the label field.

Practice inspecting data with cursors using one cursor.

  1. Select一个光标来自Show/hide data cursorsdrop-down.

  2. 将数据光标左右拖到兴趣点。您还可以使用箭头键将数据光标从示例转移到样品。

    To inspect the data at a specific point in time, click the cursor time field and enter the desired time value, for example40.33

    If the signal does not have a sample at the point of interest, the Simulation Data Inspector interpolates the value for the indicated time. An asterisk in the data cursor label indicates that the displayed value is interpolated. For information regarding interpolation methods, seeInterpolation

  3. 完成检查数据后,单击“光标”按钮以从查看区域删除光标。

Replay Data

您可以在模拟数据检查器中重播数据,以检查信号值变化和信号之间的关系。在模拟数据检查器中重播数据对任何模型或仿真没有影响。要重播数据,首先通过单击Show/hide replay controlsbutton.Then, press theReplaybutton.

The Simulation Data Inspector synchronously sweeps a cursor displaying the signal value across all subplots in the view. By default, data replays at a rate of one second per second, which means that replaying one second of data takes one second of clock time. You can adjust the replay speed using the arrows on either side of the label or by clicking the label to type the desired speed. You can also pause the replay and use theStep forwardand向后退一步buttons to inspect signal values, sample by sample. For a detailed example, see在模拟数据检查器中重播数据

检查元数据

The Simulation Data Inspector allows you to view run and signal metadata. You can view signal metadata in the特性pane or in the table of signals under each run. You can view run data only in the特性pane.

The特性pane displays the metadata for the selected run or signal. You can edit properties using the white box in the柱子。当您查看比较时,模拟数据检查器突出显示了红色的元数据差异。

列在导航窗格允许您display signal properties in the table of signals under each run. To add or remove columns in the table, select the columns you want to display from the list on theColumnstab of the navigation pane's喜好menu. Columns appear in the table in the order in which you select them.

属性名称 Value
Line Signal line style and color
Units 信号测量单元
Data Type Signal data type
复杂 信号类型 - 真实或复杂
复杂格式 Format for visualizing complex data
Sample Time Type of sampling
Model Name of the model that generated the signal
Block Name Name of the signal's source block
Block Path Path to the signal's source block
Port Index of the signal on the block's output port
Dimensions Dimensions of the matrix containing the signal
Channel Index of signal within matrix
Run Name of the simulation run containing the signal
Absolute Tolerance 用户指定的信号的正值,正值的绝对公差
Relative Tolerance 用户指定的信号的正值相对容忍度
Override Global Tolerance 用户指定的属性确定信号公差是否优先于全局公差
Time Tolerance User-specified, positive-valued time tolerance for the signal
Interp Method User-specified interpolation method used to plot the signal
Sync Method User-specified synchronization method used to coordinate signals for comparison
Time Series Root 与从MATLAB工作区导入的信号相关的变量的名称
Time Source Name of the array containing the time data for signals imported from the MATLAB workspace
Data Source 数组的名称,其中包含从MATLAB工作区导入的信号的数据

On the相比pane, many parameters have a Baseline column and a Compare To column that you can display independently. If the基线and相比to信号both have a property, but you can only display one property column, the column shows the基线财产。除了列出的参数Inspectpane, the相比窗格具有特定于比较的列。

  • 最大差异— The maximum difference between the基线and相比to信号

  • Align By— Primary signal alignment criterion specified in the结盟模拟数据检查器的选项卡喜好menu

默认情况下,table displays the baseline name column and a column indicating whether the comparisons passed or failed.

Related Topics