Main Content

plotSpectrum

System object: phased.BeamscanEstimator2D
Namespace: phased

Plot spatial spectrum

Syntax

plotSpectrum(estimator)
plotSpectrum(estimator,Name,Value)
hl = plotSpectrum(___)

Description

plotSpectrum(estimator) plots the spatial spectrum resulting from the most recent execution of the object.

plotSpectrum(estimator,Name,Value) plots the spatial spectrum with additional options specified by one or more Name,Value pair arguments.

hl = plotSpectrum(___) returns the line handle in the figure.

Input Arguments

H

Spatial spectrum estimator object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

NormalizeResponse

Set this value to true to plot the normalized spectrum. Setting this value to false plots the spectrum without normalization.

Default: false

Title

Character vector to use as figure title.

Default: ''

Unit

Plot units, specified as 'db', 'mag', or 'pow'.

Default: 'db'

Examples

expand all

Estimate the DOAs of two signals received by a 50-element URA with a rectangular lattice. The antenna operating frequency is 150 MHz. The actual direction of the first signal is -37° in azimuth and 0° in elevation. The direction of the second signal is 17° in azimuth and 20° in elevation.

antenna = phased.IsotropicAntennaElement('FrequencyRange',[100e6 300e6]);
array = phased.URA('Element',antenna,'Size',[5 10],'ElementSpacing',[1 0.6]);
fc = 150e6;
lambda = physconst('LightSpeed')/fc;
ang1 = [-37.5; 10.2];
ang2 = [17.4; 20.6];
x = sensorsig(getElementPosition(array)/lambda,8000,[ang1 ang2],0.2);
estimator = phased.BeamscanEstimator2D('SensorArray',array,'OperatingFrequency',fc, ...
    'DOAOutputPort',true,'NumSignals',2,'AzimuthScanAngles',-50:50,'ElevationScanAngles',-30:30);
[~,doas] = estimator(x);
disp(doas)
    17   -37
    20    10

Because the values for the AzimuthScanAngles and ElevationScanAngles properties have a granularity of 1, the DOA estimates are not accurate. Improve the accuracy by choosing a finer grid

estimator2 = phased.BeamscanEstimator2D('SensorArray',array,'OperatingFrequency',fc, ...
    'DOAOutputPort',true,'NumSignals',2,'AzimuthScanAngles',-50:0.05:50,'ElevationScanAngles',-30:0.05:30);
[~,doas] = estimator2(x);
disp(doas)
   17.3000  -37.4000
   20.5000   10.3000

Plot the beamscan spatial spectrum

plotSpectrum(estimator)