Accelerating the pace of engineering and science

# Documentation

## Conventional Beamforming

### Uses for Beamformers

You can use a beamformer to spatially filter the arriving signals. Accentuating or attenuating signals that arrive from specific directions helps you distinguish between signals of interest and interfering signals from other directions.

### Support for Conventional Beamforming

You can implement a narrowband phase shift beamformer using phased.PhaseShiftBeamformer. When you use this object, you must specify these aspects of the situation you are simulating:

• Sensor array

• Signal propagation speed

• System operating frequency

• Beamforming direction

For wideband beamformers, see Wideband Beamforming.

### Narrowband Phase Shift Beamformer with a ULA

Construct a ULA with 10 elements. Assume the carrier frequency is 1 GHz and set the array element spacing to be one-half the carrier frequency wavelength.

```fc = 1e9;
lambda = physconst('LightSpeed')/fc;
hula = phased.ULA('NumElements',10,'ElementSpacing',lambda/2);```

The ULA sensors are isotropic antenna elements (see phased.IsotropicAntennaElement). Set the frequency range of the antenna elements to position the carrier frequency in the middle of the operating range.

`hula.Element.FrequencyRange = [8e8 1.2e9];`

Simulate a test signal. For this example, use a simple rectangular pulse.

```t = linspace(0,0.3,300)';
testsig = zeros(size(t));
testsig(201:205)= 1;```

Assume the rectangular pulse is incident on the ULA from an angle of 30 degrees azimuth and 0 degrees elevation. Use the collectPlaneWave method of the ULA object to simulate reception of the pulse waveform from the specified angle.

```angle_of_arrival = [30;0];
x = collectPlaneWave(hula,testsig,angle_of_arrival,fc);```

x is a matrix with ten columns. Each column represents the received signal at one of the array elements.

Corrupt the columns of x with complex-valued Gaussian noise. Reset the default random number stream for reproducible results. Plot the magnitudes of the received pulses at the first four elements of the ULA.

```rng default
npower = 0.5;
x = x + sqrt(npower/2)*(randn(size(x))+1i*randn(size(x)));
subplot(221)
plot(t,abs(x(:,1))); title('Element 1 (magnitude)');
axis tight;  ylabel('Magnitude');
subplot(222)
plot(t,abs(x(:,2))); title('Element 2 (magnitude)');
axis tight; ylabel('Magnitude');
subplot(223)
plot(t,abs(x(:,3))); title('Element 3 (magnitude)');
axis tight; xlabel('Seconds'); ylabel('Magnitude');
subplot(224)
plot(t,abs(x(:,4))); title('Element 4 (magnitude)');
axis tight; xlabel('Seconds'); ylabel('Magnitude');```

Construct your phase-shift beamformer. Set the WeightsOutputPort property to true to output the spatial filter weights.

```hbf = phased.PhaseShiftBeamformer('SensorArray',hula,...
'OperatingFrequency',1e9,'Direction',angle_of_arrival,...
'WeightsOutputPort',true);```

Apply the step method for the phase shift beamformer. The step method computes and applies the correct weights for the specified angle. The phase-shifted outputs from the ten array elements are then summed.

`[y,w] = step(hbf,x);`

Plot the magnitude of the output waveform along with the original waveform for comparison.

```figure;
subplot(211)
plot(t,abs(testsig)); axis tight;
title('Original Signal'); ylabel('Magnitude');
subplot(212)
plot(t,abs(y)); axis tight;
ylabel('Magnitude'); xlabel('Seconds');```

To examine the effect of the beamforming weights on the array response, plot the array normalized power response both with—and without—the beamforming weights.

```azang = -180:30:180;
figure;
subplot(211)
plotResponse(hula,fc,physconst('LightSpeed'));
set(gca,'xtick',azang);
title('Array Response without Beamforming Weights');
subplot(212)
plotResponse(hula,fc,physconst('LightSpeed'),'weights',w);
set(gca,'xtick',azang);
title('Array Response with Beamforming Weights');```