Main Content

CursorMeasurementsConfiguration

Measure signal values using vertical waveform cursors that track along the signal

Since R2023a

    Description

    Use the CursorMeasurementsConfiguration object to enable waveform cursors. You can control the cursor settings from the toolstrip of the scope or from the command line.

    To display vertical cursors on each signal and to modify the cursor settings in the scope UI, click the Measurements tab and enable Data Cursors. Each cursor tracks a vertical line along the signal. The scope displays the difference between x- and y-values of the signal at the two cursors in the box between the cursors. The cursors appear only when the Spectrum Analyzer has at least one signal in its display. You can use the mouse to move the vertical cursors left and right.

    The SpectrumAnalyzerBlockConfiguration object supports the CursorMeasurementsConfiguration object in the command line.

    Spectrum Analyzer Toolstrip

    Snapshot showing cursor measurements in Spectrum Analyzer toolstrip.

    Creation

    Description

    cursormeas = CursorMeasurementsConfiguration() creates a cursor measurements configuration object.

    example

    Properties

    expand all

    All properties are tunable.

    x-coordinates of the cursors, specified as a two-element vector of real numbers.

    Scope Window Use

    On the Measurements tab, select Data Cursors and then click Data Cursors to specify the two elements in X location properties.

    Data Types: double

    Position cursors on the signal data points, specified as true or false.

    Scope Window Use

    On the Measurements tab, select Data Cursors and then click Data Cursors to select Snap to data.

    Data Types: logical

    Lock spacing between cursors, specified as true or false. Set this property to true to lock the frequency difference between the cursors.

    Scope Window Use

    On the Measurements tab, select Data Cursors and then click Data Cursors to select Lock cursor spacing.

    Data Types: logical

    Enable cursor measurements, specified as true or false. Set this property to true to enable cursor measurements.

    Scope Window Use

    On the Measurements tab, select Data Cursors.

    Data Types: logical

    Examples

    collapse all

    Open and run the water hammer model.

    open_system('WaterHammerEffect')
    sim('WaterHammerEffect')
    

    The Spectrum Analyzer in this model shows the power spectrum of the water pressure in the pipe. For more details on this model, see the Water Hammer Effect example.

    You can obtain or modify the peak, cursor, and distortion measurements in the spectrum programmatically by enabling these properties in the SpectrumAnalyzerConfiguration object.

    • PeakFinder

    • CursorMeasurements

    • DistortionMeasurements

    Access the configuration properties of the Spectrum Analyzer block using the get_param function.

    sablock = 'WaterHammerEffect/Spectrum Analyzer';
    cfg = get_param(sablock,'ScopeConfiguration');
    

    To enable these measurements, set the Enabled property to true.

    cfg.CursorMeasurements.Enabled = true;
    cfg.PeakFinder.Enabled = true;
    cfg.DistortionMeasurements.Enabled = true;
    

    You can now modify these measurements programmatically. As an example, display the first five peaks in the spectrum display. By default, the spectrum shows only three peaks. To modify the number of peaks it shows, change NumPeaks to 5. You can even label the peaks using the LabelPeaks property and control the minimum distance between adjacent peaks using the MinDistance property. The changes you make to these properties update the spectra accordingly.

    cfg.PeakFinder.NumPeaks = 5;
    

    Version History

    Introduced in R2023a