Main Content

dsp.MatrixViewer

Visualize matrix data

Since R2019a

Description

The dsp.MatrixViewer visualizes matrix data by mapping the matrix elements to a specified range of colors.

来visualize matrix data in the Matrix Viewer:

  1. Create thedsp.MatrixViewerobject and set its properties.

  2. Call the object with arguments, as if it were a function.

来learn more about how System objects work, seeWhat Are System Objects?

Zoom and Pan

来scale the plot axes, you can use the scroll button on your mouse to zoom in/out of the plot andCTRL+Clickand drag to pan around the plot. Additionally, you can use the buttons that appear when you hover over the upper right corner of the plot window.

  • — Autoscale the axes to fit the data.

  • — Zoom in to the plot.

  • — Pan around the axes.

Cursor Measurements

交流tivate cursor measurements by hovering over the matrix viewer and selecting the cursor button.

Two horizontal and two vertical cursors appear on the plot. A dialog box shows the difference between the two intersection points. Hovering over an intersection point shows the value at that intersection point. Move the cursors by clicking and dragging the cursor lines or the intersection points to your desired location. Additionally, you canAlt+Clickand drag the cursor dialog box to move the cursors while keeping the distance between the cursor lines constant.

Creation

Description

scope= dsp.MatrixViewercreates a Matrix Viewer System object™,scope.

example

scope= dsp.MatrixViewer(Name,Value)sets properties using one or more name-value pairs. Enclose each property name in single quotes. For example,scope = dsp.MatrixViewer("AxisOrigin","Lower left corner")

Properties

expand all

Unless otherwise indicated, properties arenontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and thereleasefunction unlocks them.

If a property istunable, you can change its value at any time.

For more information on changing property values, seeSystem Design in MATLAB Using System Objects.

Matrix Information

Specify thex-axis numbering mode.

  • "Offset and resolution"– Compute thex-axis data points from theXResolutionandXOffsetproperties.

  • "Custom"– Compute thex-axis data points using theCustomXDataproperty.

Data Types:char|string

Specify they-axis numbering mode:

  • "Span and resolution"– Compute they-axis data points from theYSpanandYResolutionproperties.

  • "Offset and resolution"– Compute they-axis data points from theYResolutionandYOffsetproperties.

  • "Custom"– Compute they-axis data points using theCustomYDataproperty.

Data Types:char|string

Specify custom values for thex-axis using a two-element numeric vector or a numeric vector with a finite number of elements.

If you specify a two-element vector, the numbers are used as the min and max values of thex-axis. If you specify a vector with more than two elements, the values must be monotonically increasing and the scope uses the first and last values of the vector as the minimum and maximum values, respectively. If you do not specifyx-axis data limits, the scope uses the number of input columns as the maximumx-axis value.

Example:[5 156]

可调:Yes

Dependency

来enable this property, you must setXDataModeto"Custom".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify custom values for they-axis using a two-element numeric vector or a numeric vector with a finite number of elements.

If you specify a two-element vector, the numbers are used as the min and max values of they-axis. If you specify a vector with more than two elements, the values must be monotonically increasing and the scope uses the first and last values of the vector as minimum and maximum values, respectively. If you do not specifyy-axis data limits, the scope uses the number of input rows as the maximumy-axis value.

Example:[-130 10]

可调:Yes

Dependency

来enable this property, you must setYDataModeto"Custom".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the offset to display on thex-axis as a scalar.

可调:Yes

Dependency

来enable this property, you must setXDataModeto"Offset and resolution".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the spacing of values along thex-axis as a scalar.

可调:Yes

Dependency

来enable this property, you must setXDataModeto"Offset and resolution".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the offset to display on they-axis as a scalar.

可调:No

Dependency

来enable this property, you must setYDataModeto"Offset and resolution".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the spacing of values along they-axis as a scalar.

可调:No

Dependency

来enable this property, you must setYDataModeto"Offset and resolution"or"Span and resolution".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Specify the span of values along they-axis as a scalar.

可调:No

Dependency

来enable this property, you must setYDataModeto"Span and resolution".

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Visualization

Specify the name of the scope. This name appears as the title of the scope's figure window. To specify the title of plot, use theTitleproperty.

Data Types:char|string

Specify the starting location of the plot. If you specify“左上角”, the plot starts in the top left corner of the axes and continues down.

Data Types:char|string

Specify, in pixels, the size and location of the scope window as a four-element vector of the form[left bottom width height]. By default, the scope window appears in the center of your screen with a width of410pixels and height of300pixels. The default values for this property may change depending on your screen resolution.

Specify the title of the plot as a character vector or string. By default, there is no title.

可调:Yes

Data Types:char|string

Specify the text for the scope to display below thex-axis. By default, the axes is unlabeled.

可调:Yes

Data Types:char|string

Specify the text for the scope to display to the left of they-axis. By default, the axes is unlabeled.

可调:Yes

Data Types:char|string

Specify the text for the scope to display next to the color bar. By default, the color bar is unlabeled.

可调:Yes

Data Types:char|string

Color scheme for the colormap, specified as a predefined colormap name or a three-column matrix of RGB triplets.

For a list of acceptable colormap names, seemap.

来use a custom colormap, specify a three-column matrix of RGB triplets. You can create the RGB matrix yourself, or you can call a predefined colormap function, such ascolormap, to create the matrix.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|char|string

Specify the color bar limits as a two-element numeric vector[min max]. By default, limits are set as the minimum and maximum values of the input matrix.

Example:[1 80]

可调:Yes

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Location of the color bar relative to the axes.

可调:Yes

Data Types:char|string

Set this property tofalseto hide the color bar on the plot.

Set this property tofalse隐藏网格线的阴谋。

可调:Yes

Set this property tofalseto hide the ticks on thex-axis andy-axis.

Usage

Syntax

Description

example

scope(matrix)displays thematrixby mapping matrix element values to a range of colors.

Input Arguments

expand all

Specify ann-by-mnumeric matrix to visualize.

Example:scope(rand(3,5))

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|logical

Object Functions

来use an object function, specify the System object as the first input argument. For example, to release system resources of a System object namedobj, use this syntax:

release(obj)

expand all

setCursorDataLabels Customize data labels for cursor measurements
show Display scope window
hide Hide scope window
isVisible Determine visibility of scope
step RunSystem objectalgorithm
release Release resources and allow changes toSystem objectproperty values and input characteristics
reset Reset internal states ofSystem object

Examples

collapse all

This example shows how to create a spectrogram of a quadratic chirp with thedsp.MatrixViewerSystem object.

Set up the sample rate and a chirp signal.

Fs = 233e3; frameSize = 20e3; chirp = dsp.Chirp("SampleRate",Fs,“SamplesPerFrame”,frameSize,..."InitialFrequency",11e3,"TargetFrequency",11e3+55e3,..."Type","Quadratic");

Create adsp.MatrixViewerscope. Set the axis labels, select a colormap, and set the limits of the colormap.

scope = dsp.MatrixViewer(..."ColorBarLabel","Power/Frequency (dB/Hz)",..."XLabel","Frequency (Hz)",..."YLabel","Time (secs)",..."Colormap","hsv",..."ColorLimits",[-100,-30]);

Visualize the spectrogram of the chirp signal in the scope.

foridx = 1:50 y = chirp() + 0.05*randn(frameSize,1); [~,~,~,Ps] = spectrogram(y,128,120,128,1e3); val = 10*log10(abs(Ps)'+eps); scope(val);end

版本历史

Introduced in R2019a