delay and sum beamforming

1 visualización (últimos 30 días)
Dhananjay Singh
Dhananjay Singh el 18 de Mzo. de 2019
Comentada: Naman Bhaia el 21 de Mzo. de 2019
Hi, i am running a program for dealy and sum beamforming. When i run the program i get this error
"Error using line
Vectors must be the same length.
Error in examplesSteeredResponse (line 64)
line(ax, [thetaScanAngles(indx) thetaScanAngles(indx)], ax.YLim,'LineWidth', 1, 'Color', 'r', 'LineStyle', '--');"
Here's some part of the code i am running:
%% Examples on delay-and-sum response for different arrays and input signals
%% 1D-array case
% Create vectors of x- and y-coordinates of microphone positions
xPos = -0.8:0.2:0.8; % 1xP vector of x-positions [m]
yPos = zeros(1, numel(xPos)); % 1xP vector of y-positions [m]
zPos = zeros(1, numel(xPos));
elementWeights = ones(1, numel(xPos))/numel(xPos); % 1xP vector of weightings
% Define arriving angles and frequency of input signals
thetaArrivalAngles = [-30 10]; % degrees
phiArrivalAngles = [0 0]; % degrees
f = 800; % [Hz]
c = 340; % [m/s]
fs = 44.1e3; % [Hz]
% Define array scanning angles (1D, so phi = 0)
thetaScanAngles = -90:0.1:90; % degrees
phiScanAngles = 0; % degrees
% Create input signal
inputSignal = createSignal(xPos, yPos, zPos, f, c, fs, thetaArrivalAngles, phiArrivalAngles);
% Create steering vector/matrix
e = steeringVector(xPos, yPos, zPos, f, c, thetaScanAngles, phiScanAngles);
% Create cross spectral matrix
R = crossSpectralMatrix(inputSignal);
% Calculate delay-and-sum steered response
S = steeredResponseDelayAndSum(R, e, elementWeights);
%Normalise spectrum
spectrumNormalized = abs(S)/max(abs(S));
%Convert to decibel
spectrumLog = 10*log10(spectrumNormalized);
%Plot array
fig1 = figure;
fig1.Color = 'w';
ax = axes('Parent', fig1);
scatter(ax, xPos, yPos, 20, 'filled')
axis(ax, 'square')
ax.XLim = [-1 1];
ax.YLim = [-1 1];
grid(ax, 'on')
title(ax, 'Microphone positions')
%Plot steered response with indicator lines
fig2 = figure;
fig2.Color = 'w';
ax = axes('Parent', fig2);
plot(ax, thetaScanAngles, spectrumLog)
grid(ax, 'on')
ax.XLim = [thetaScanAngles(1) thetaScanAngles(end)];
for j=1:numel(thetaArrivalAngles)
indx = find(thetaScanAngles >= thetaArrivalAngles(j), 1);
line(ax, [thetaScanAngles(indx) thetaScanAngles(indx)], ax.YLim,'LineWidth', 1, 'Color', 'r', 'LineStyle', '--');
end
xlabel(ax, '\theta')
ylabel(ax, 'dB')
  1 comentario
Naman Bhaia
Naman Bhaia el 21 de Mzo. de 2019
Hello Dhananjay,
I think this question was posted twice by mistake. There are people from the community answering on the other question so please redirect there to follow that thread.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Array Geometries and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by