Display Time-Domain Data in Signal Browser

This example shows how to use and configure the SPTool Signal Browser to display time-domain signals. First, open SPTool by typing

sptoolsptool

at the MATLAB® command line. SPTool opens.

Import and Display Signals

Displaying Multiple Signals

You can display multiple signals in the Signal Browser by selecting more than one entry in the SPTool Signals list. In the Signals list, first select mtlb [vector]. Next, press the Ctrl key, and select chirp [vector]. Finally, click the View button. The Signal Browser opens, displaying both signals.

Any signals that you select in SPTool are now visible in the Signal Browser. You can also select multiple entries using the Shift key. In the SPTool Signals list, first select mtlb [vector]. Next, press the Shift key, and select train [vector]. The Signal Browser automatically updates to display all three signals, as shown in the following figure.

Importing New Signals

Using SPTool, you can import signals from variables in the MATLAB workspace. First, create a 3-second signal, sampled at 10 kHz, that is the sum of two sine waves. At the MATLAB command line, enter the following commands:

Fs = 1e4;
t = 0:1/Fs:3;
s = sum(sin(2*pi*[350;440]*t));

To import the signal from these variables, in the SPTool menu, select File > Import. Alternatively, you can press the Ctrl+I keyboard shortcut. The Import to SPTool dialog box opens.

From the Workspace Contents list, select s. Click the right arrow ( ) button to the left of the Data box. Next, from the Workspace Contents list, select Fs. Click the right arrow ( ) button to the left of the Sampling Frequency box. You can assign the signal a name in the Name box, but since you will rename the signal later in this example, leave it as sig1 for now.

Click OK. The SPTool Signals list now contains a signal named sig1 [vector].

Selecting a Signal and Playing Audio

In the SPTool Signals list, select sig1 [vector], and click the View button. The Signal Browser reappears in front. To play audio for the signal, click the Play selected signal ( ) button. Signal Browser sends the audio signal to the speaker. For more information, see sound in the MATLAB documentation.

If you have multiple signals selected in SPTool, you can use the Trace Selection panel to choose which signal to make active. In the SPTool Signals list, press the Ctrl key, and select mtlb [vector]. The Signal Browser now displays two signals. In the Signal Browser menu, select Tools > Measurements > Trace Selection. The Trace Selection panel appears as shown in the following figure.

In the Trace Selection panel drop-down list, select sig1. Then, click the Play selected signal ( ) button. Signal Browser sends the audio signal to the speaker.

    Note:   To hear audio when you click the Play selected signal ( ) button, your computer sound card must be able to support the sample rate of the signal. In this example, the sample rate of the signal, sig1 [vector], is 10 kHz. If your sound card supports this or a greater sample rate, such as 44.1 kHz, then you can hear the audio on your speaker. For more information, see sound in the MATLAB documentation.

Change Signal Names from the Legend

When multiple signals are displayed, Signal Browser shows a legend by default. To turn off the legend, click the Show all legends ( ) button. Click the button again to turn the legend back on. You can modify the names of the signal directly in the legend. To do so, when the legend is visible, click and drag it to any location on the display.

You can change the name of any signal directly within the legend. In the legend, double-click the signal name sig1. A cursor appears, indicating that you can now change this name. Highlight the text, and type Dial Tone. The legend now shows Dial Tone as the name of that signal. In the SPTool Signals list, the last item is now also named Dial Tone.

Configure the Signal Browser Properties

First, configure the appearance of the Signal Browser window. In the SPTool Signals list, first select mtlb [vector]. Next, press the Shift key, and select train [vector]. The Signal Browser automatically updates to display all three signals.

Multiple Displays

You can display multiple signals on different displays in the Signal Browser window. In the SPTool Signals list, first ensure all three signals are selected. In the Signal Browser toolbar, click the Layout ( ) button. Select row 3, column 1, as shown in the following figure.

After you make this selection, the Signal Browser is separated into three displays.

Configure Appearance

In the Signal Browser menu, select View > Properties. The Visuals:Time Domain Options dialog box opens, as shown in the following figure.

In the Visuals:Time Domain Options dialog box, click the Main tab. Choose the appropriate parameter settings for the Main tab, as shown in the following table.

ParameterSetting
Time unitsMetric (based on Time Span)
Show time-axis labelsBottom Displays Only
Maximize axesOn

When you change the Maximize axes parameter to On, the axes are expanded to fill the entire display. To conserve space, titles and axis labels are not shown in each display. Click Apply.

Set Display Properties

In the Visuals:Time Domain Options dialog box, click the Display tab. You can change the value of the Select display parameter to make different settings for each display. Set the parameters to the values shown in the following table.

ParameterDisplay 1 SettingDisplay 2 SettingDisplay 3 Setting
Select display123
Titlemtlbchirptrain
Show legendSelectedSelectedSelected
Show gridSelectedSelectedSelected
Plot signal(s) as magnitude and phaseClearedClearedCleared
Minimum Y-limit-2.5-1-1.5
Maximum Y-limit2.511.5
Y-axis labelAmplitudeAmplitudeAmplitude

Click OK to save your changes and close the Visuals:Time Domain Options dialog box. The Signal Browser appears as shown in the following figure.

Modify the Signal Browser Display

Use the Style dialog box to modify the appearance of the axes and the lines for each of the selected signals in SPTool. In the Signal Browser menu, select View > Style. The Style dialog box opens, as shown in the following figure.

Modify Axes Colors and Line Properties

You can change the value of the Select display parameter to make different settings for each display. Set the parameters to the values shown in the following table.

ParameterDisplay 1 SettingDisplay 2 SettingDisplay 3 Setting
Select display123
Axes background colorBlackBlackBlack
Ticks, labels, and grid colorsWhiteWhiteWhite
Line colorYellowCyanMagenta

These settings enable the Signal Browser to display line colors in the same manner as the Simulink® Scope block. Click OK to save your changes and close the Style dialog box. The Signal Browser now appears as shown in the following figure.

Show and Hide Toolbar

To hide the toolbar, from the Signal Browser menu, select View > Toolbar. Doing so removes the toolbar from the Signal Browser window and also removes the check mark beside the Toolbar option in the View menu. You can choose to show the toolbar again at any time by selecting View > Toolbar.

Inspect Your Data (Scaling the Axes and Zooming)

So far, you have manually set the y-axis limits. Use one of the following options to let Signal Browser scale the axes:

  • From the Signal Browser menu, select Tools > Scale Axes Limits.

  • From the Signal Browser toolbar, click the Scale Axes Limits ( ) button.

  • With the Signal Browser as your active window, press Ctrl + A.

Use the Zoom Tools

The zoom tools allow you to zoom in simultaneously in the directions of both the x- and y-axes , or in either direction individually. For example, to zoom in on the signal between 0 and 0.5 seconds, you can use the Zoom X option.

  • To activate the Zoom X tool, select Tools > Zoom X, or press the corresponding toolbar button ( ). The Signal Browser indicates that the Zoom X tool is active by indenting the toolbar button and placing a check mark next to the Tools > Zoom X menu option.

  • Next, zoom in on the region between 0 and 0.5 seconds. In the Signal Browser window, click on the 0-second mark and drag to the 0.5-second mark. All three displays reflect this new x-axis setting, as shown in the following figure.

  • To zoom out of the Signal Browser window, right-click inside the window, and select Zoom Out. Alternatively, you can return to the original view of your signal by right-clicking inside the Signal Browser window and selecting Reset to Original View.

Was this topic helpful?