# Documentation

## Beamscan Direction-of-Arrival Estimation

This example shows how to use the nonparametric beamscan technique to estimate the direction of arrival (DOA) of signals. The beamscan algorithm estimates the DOAs by scanning the array beam over a region of interest. The algorithm computes the output power for each beam scan angle and identifies the maxima as the DOA estimates.

Construct a ULA consisting of ten elements. Assume the carrier frequency of the incoming narrowband sources is 1 GHz.

```fc = 1e9; lambda = physconst('LightSpeed')/fc; hula = phased.ULA('NumElements',10,'ElementSpacing',lambda/2); hula.Element.FrequencyRange = [8e8 1.2e9];```

Assume that there is a wavefield incident on the ULA consisting of two linear FM pulses. The DOAs of the two sources are 30 degrees azimuth and 60 degrees azimuth. Both sources have elevation angles of zero degrees.

```hwav = phased.LinearFMWaveform('SweepBandwidth',1e5,... 'PulseWidth',5e-6,'OutputFormat','Pulses','NumPulses',1); sig1 = step(hwav); sig2 = sig1; ang1 = [30; 0]; ang2 = [60;0]; arraysig = collectPlaneWave(hula,[sig1 sig2],[ang1 ang2],fc); rng default npower = 0.01; noise = sqrt(npower/2)*... (randn(size(arraysig))+1i*randn(size(arraysig))); rxsig = arraysig+noise;```

Implement a beamscan DOA estimator. Output the DOA estimates, and plot the spatial spectrum.

```hbeam = phased.BeamscanEstimator('SensorArray',hula,... 'OperatingFrequency',fc,'ScanAngles',-90:90,... 'DOAOutputPort',true,'NumSignals',2); [y,sigang] = step(hbeam,rxsig); plotSpectrum(hbeam);```

Get trial now