Main Content

plotTOASpectrum

Estimate and plot signal time-of-arrival (TOA) spectrum

Since R2024a

Description

Estimate and plot the signal time-of-arrival (TOA) spectra for all L anchors.

[toagrid,toaspectrum,toaest] = plotTOASpectrum(estim,freqspacing) plots the time-of-arrival (TOA) spectrum of the phased.TOAEstimator System object™ estim. The object function also returns the TOA grid, toagrid, the TOA spectrum, toaspectrum, and the estimated TOA from the phased.TOAEstimator System object estim. The input freqspacing is the frequency spacing of each channel estimate.

To use this function, you must first create and execute the phased.TOAEstimator System object estim.

example

[toagrid,toaspectrum,toaest] = plotTOASpectrum(___,Name=Value) also specifies one or more name-value arguments, in addition to the input arguments from the previous syntax. For example, AnchorIndex=4 specifies the fourth anchor in the channel (see Name-Value Arguments). You can specify multiple name-value pair arguments in any order as Name1=Value1,...,NameN=ValueN.

example

Examples

collapse all

Use received signals from five anchors having known positions to perform FFT-based TOA estimation. Obtain TDOA measurements,and then perform two-step WLLS-based TDOA positioning. Use the data from the TOAEstimatorExampleData file, which contains these variables:

Variable

Definition

toa

Anchor TOAs

N

Number of sub-bands

M

Number of channel samples

freqspacing

Frequency spacing

npow

Noise power

anchorpos

Anchor positions

tgtpos

Actual target position

First, load the data from the file.

load TOAEstimatorExampleData

Create an exponential signal in a noise-free frequency-domain channel.

expsignal = exp(-1j*2*pi*(1:N)'*freqspacing*toa);

Create frequency-domain channel estimate.

X = cell(1,L);
for l = 1:L
    X{l} = expsignal(:,l)*ones(1,M) + ...
        sqrt(npow/2)*(randn(N,M)+1j*randn(N,M));
end

Configure a TDOA estimator to perform FFT-based spectrum analysis.

tdoaEstimator = phased.TOAEstimator(Measurement="TDOA", ...
    SpectrumMethod="FFT",NoisePower=npow, ...
    VarianceOutputPort=true,TargetPositionOutputPort=true);

Estimate TDOA from the estimated TOA.

[tdoaest,tdoavar,tgtposest] = tdoaEstimator(X,freqspacing,anchorpos);

Find the rmse target position estimate.

rmsetgtpos = rmse(tgtposest,tgtpos);
disp(["RMS TDOA positioning error = ",num2str(rmsetgtpos), "meters."])
    "RMS TDOA positioning error = "    "0.10657"    "meters."

Plot the TOA spectrum.

[toaGrid,toaSpectrum,toaEst] = plotTOASpectrum( ...
    tdoaEstimator,freqspacing,AnchorIndex=1, ...
    MaxDelay=200e-9);

Figure contains an axes object. The axes object with title FFT TOA Spectrum, xlabel TOA (ns), ylabel Power (dB) contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent TOA Spectrum, TOA Estimate.

Use received signals from five anchors having known positions to perform FFT-based TOA estimation. Obtain TDOA measurements,and then perform two-step WLLS-based TDOA positioning. Use the data from the TOAEstimatorExampleData file, which contains these variables:

Variable

Definition

toa

Anchor TOAs

N

Number of sub-bands

M

Number of channel samples

freqspacing

Frequency spacing

npow

Noise power

anchorpos

Anchor positions

tgtpos

Actual target position

First, load the data from the file.

load TOAEstimatorExampleData

Create an exponential signal in a noise-free frequency-domain channel.

expsignal = exp(-1j*2*pi*(1:N)'*(freqspacing*toa));

Create frequency-domain channel estimate with added Gaussian white noise.

  X = cell(1,L);
  for l = 1:L
      X{l} = expsignal(:,l)*ones(1,M) + ...
          sqrt(npow/2)*(randn(N,M)+1j*randn(N,M));
  end

Configure TOA estimator for MUSIC-based spectrum analysis.

toaEstimator = phased.TOAEstimator(Measurement="TOA", ...
SpectrumMethod="MUSIC",VarianceOutputPort=true, ...
NoisePower=npow,ForwardBackwardAveraging=true, ...
SpatialSmoothing=ceil(N/2));

Perform TOA estimation.

[toaest,toavar] = toaEstimator(X,freqspacing);

Perform TOA-based position estimation.

[tgtposest,tgtposcov] = toaposest(toaest,toavar,anchorpos);

Compute the RMSE target position estimate.

rmsepos = rmse(tgtposest,tgtpos);
disp(["RMS TOA positioning error = ", num2str(rmsepos), " meters."])
    "RMS TOA positioning error = "    "0.10669"    " meters."

Plot the TOA spectrum.

[toaGrid,toaSpectrum,toaEst] = plotTOASpectrum( ...
    toaEstimator,freqspacing,AnchorIndex=1, ...
    MaxDelay=200e-9);

Figure contains an axes object. The axes object with title MUSIC TOA Spectrum, xlabel TOA (ns), ylabel Power (dB) contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent TOA Spectrum, TOA Estimate.

Input Arguments

collapse all

TOA estimator, specified as a phased.TOAEstimator System object.

Frequency spacings of channel estimates, specified as a positive scalar or a 1-by-L vector of positive values. If freqspacing is a scalar, the frequency spacing is the same for all L anchors. If freqspacing is a 1-by-L vector, each element specifies the frequency spacing for the corresponding. Units are in Hz.

Example: [10e6 15e6 20e6]

Data Types: single | double

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.

Example: plotTOASpectrum(estim,freqspacing,AnchorIndex=4) specifies the fourth anchor in the channel.

Anchor index, specified as a positive integer from 1 to L where L is the number of anchors.

Example: 4

Data Types: single | double

Maximum delay in the TOA spectrum plot, specified as positive scalar. The default value is the maximum unambiguous delay at the first anchor. Units are in seconds.

Example: 1e-6

Data Types: double

Output Arguments

collapse all

Time-of-arrival grid, returned as a P-by-L matrix or 1-by-L cell array, where L is the number of anchors.

  • If the channel estimation matrix is an N-by-M-by-L array, then toagrid is a P-by-L matrix.

  • If the channel estimate X is a 1-by-L cell array, then toagrid is a 1-by-L cell array, containing the TOA grid for each of the L anchors.

Units are in seconds.

Data Types: single | double

TOA spectrum, returned as a P-by-1 real-valued vector.

TOA estimate, returned as a scalar. Units are in seconds.

Data Types: single | double

Version History

Introduced in R2024a