Main Content

DistortionMeasurementsConfiguration

Compute and display harmonic and intermodulation distortion

Since R2023a

    Description

    Use the DistortionMeasurementsConfiguration object to compute and display harmonic and intermodulation distortion.

    You can specify the distortion type, number of harmonics, and label the harmonics. You can control the distortion settings from the Spectrum Analyzer toolstrip or from the command line. The SpectrumAnalyzerBlockConfiguration object supports the DistortionMeasurementsConfiguration object in the command line.

    To modify the distortion settings in the Spectrum Analyzer toolstrip, click the Measurements tab and edit the settings in the Distortion section.

    Snapshot showing distortion measurements.

    Creation

    Description

    example

    distmeas = DistortionMeasurementsConfiguration() creates a distortion measurements configuration object distmeas.

    Properties

    expand all

    All properties are tunable.

    Type of measurement data to display, specified as "harmonic" or "intermodulation".

    Scope Window Use

    Click the Measurements tab on the Spectrum Analyzer toolstrip. In the Distortion section, set Distortion Type to Harmonic or Intermodulation.

    The Measurements tab appears when you select Spectrum in the Scope tab.

    Data Types: char | string

    Number of harmonics to measure, specified as a positive integer less than or equal to 99.

    Dependency

    To enable this property, set Type to "harmonic".

    Scope Window Use

    Click the Measurements tab on the Spectrum Analyzer toolstrip. In the Distortion section, set Num Harmonics to a positive integer less than or equal to 99.

    The Measurements tab appears when you select Spectrum in the Scope tab.

    Data Types: double

    Label harmonics (for harmonic distortion) and frequencies (for intermodulation distortion), specified as true or false.

    Scope Window Use

    Click the Measurements tab on the Spectrum Analyzer toolstrip. In the Distortion section, select Label Harmonics.

    The Measurements tab appears when you select Spectrum in the Scope tab.

    Data Types: logical

    Enable distortion measurements, specified as true or false.

    Scope Window Use

    Click the Measurements tab on the Spectrum Analyzer toolstrip. In the Distortion section, select Distortion.

    The Measurements tab appears when you select Spectrum in the Scope tab.

    Data Types: logical

    Examples

    collapse all

    Open and run the signal amplifier model.

    open_system('amplifySigNoise.slx')
    sim('amplifySigNoise.slx')
    

    The Spectrum Analyzer blocks in the model show the amplified noise and the signal power plots, respectively. For more details on this model, see the Analysis of Frequency Response of RF System example.

    You can obtain or modify the peak, cursor, and distortion measurements in the spectra 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.

    sablockNoise = 'amplifySigNoise/Noise';
    cfgNoise = get_param(sablockNoise,'ScopeConfiguration');
    sablockPwr = 'amplifySigNoise/Power';
    cfgPwr = get_param(sablockPwr,'ScopeConfiguration');
    

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

    cfgNoise.CursorMeasurements.Enabled = true;
    cfgNoise.PeakFinder.Enabled = true;
    cfgNoise.DistortionMeasurements.Enabled = true;
    cfgPwr.CursorMeasurements.Enabled = true;
    cfgPwr.PeakFinder.Enabled = true;
    cfgPwr.DistortionMeasurements.Enabled = true;
    

    You can now modify these measurements programmatically. As an example, display the first two peaks on the spectrum display. By default, the spectrum shows three peaks. To modify the number of peaks it shows, change NumPeaks to 2. 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.

    cfgNoise.PeakFinder.NumPeaks = 2;
    cfgPwr.PeakFinder.NumPeaks = 2;
    

    Version History

    Introduced in R2023a