I need some help with a simple delay and sum linear array beamforming code

This is my code so far. I need it to work for beam steering. What should I do?
clc close all
ANGLE_RESOLUTION= 500; % // Number of angle points to calculate
numElements = 4; %// Number of array elements
spacing = 0.2; %// Element separation in metres
freq = 1000.0; %// Signal frequency in Hz
%Fs=40000;
%f=freq/Fs;
speedSound = 343.0; %// m/s
array=[];
for a=1:ANGLE_RESOLUTION
angle = -90 + 180.0 * a / (ANGLE_RESOLUTION-1);
angleRad = pi * angle / 180;
realSum = 0;
% imagSum = 0;
for i=1 : numElements
position = i * spacing;
delay = position * sin(angleRad) / speedSound;
realSum =realSum+ cos(2.0 * pi * freq * delay);
% imagSum =imagSum+ sin(2.0 * pi * freq * delay);
end;
output = sqrt(realSum * realSum ) / numElements;
logOutput(a) = 20 * log10(output);
if (logOutput < -50)
logOutput = -50;
end;
array=[array logOutput(a)];
end;

Respuestas (1)

angle = -90 + 180.0 * a / (ANGLE_RESOLUTION-1);
why doing this?

Preguntada:

el 17 de Abr. de 2013

Respondida:

el 27 de Feb. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by