Main Content

plotTOASpectrum

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

Since R2024a

Description

example

[toagrid,toaspectrum,toaest] = plotTOASpectrum(estim,freqspacing) plots the TOA spectrum and returns the TOA estimate for the time-of-arrival phased.TOAEstimator System object estim. freqspacing is the frequency spacing of each channel estimate. toagrid is the TOA grid, toaspectrum is the TOA spectrum, and toaest is the estimated TOA. This function is only usable after executing the object.

[toagrid,toaspectrum,toaest] = plotTOASpectrum(___,Name=Value) plots the TOA spectrum where the specified parameter Name is set to the specified Value. You can specify additional name-value pair arguments in any order as Name1=Value1,...,NameN=ValueN.

Examples

collapse all

Use received signals from five anchors with known positions to perform FFT-based TOA estimation. Obtain TDOA measurements followed by two-step WLLS-based TDOA positioning. The data is loaded from the TOAEstimatorExampleData file whose variables are here:

  • 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 data from 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 rms target position estimate.

rmsetgtpos = rmse(tgtposest,tgtpos);
disp(['RMS TDOA positioning error = ',num2str(rmsetgtpos),' meters.'])
RMS TDOA positioning error = 0.10661 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.

Perform MUSIC-based TOA estimation to obtain position estimates using received signals from five anchors with known positions. The data is loaded from the TOAEstimatorExampleData file whose variables are listed here:

  • 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

Load signal data.

load TOAEstimatorExampleData; 

Create the noise-free exponential signal models for all channels.

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

Add 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.

Input Arguments

collapse all

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

Frequency spacing, specified as a 1-by-L real-valued vector.

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: AnchorIndex=4

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

Example: 10

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, where P is the number of TOA grid samples. If the channel estimate X is a 1-by-L cell array, 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