Skip to content
Snippets Groups Projects
Commit e5d4eb0c authored by Achilles Kappis's avatar Achilles Kappis
Browse files

Add function to calculate the array manifold of an arbitrary array

parent bc76efb0
No related branches found
No related tags found
No related merge requests found
%% Calculate the array manifold (steering vector) of an arbitrary array
% --------------------------------------------------
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
%
% Date: 28/05/2024 (DD/MM/YYYY)
%
% Copyright: MIT
% --------------------------------------------------
% Functionality: Calculate the array manifold (steering vector) of an
% arbitrary array.
% --------------------------------------------------
% Input
%
% mPos [numeric]: The positions of the sensors in Cartesian coordinates.
% This must be an Mx3 matrix where M denotes the number of
% sensors and for each sensor the coordinates are in
% [x, y, z] format.
%
% dirs [numeric]: These are the directions for which the array manifold
% will be calculated. This must be an Nx2 matrix where N is
% the number of directions and for each direction the
% azimuth and elevation/inclination is given. The values
% must be provided in radians. The directions must be
% pointing towards the incoming plane waves and not towards
% the array/origin.
%
% k [numeric]: The wavenumbers of interest. This must be a vector
% containing all the wavenumbers for which the array manifold
% will be calculated.
%
% --------------------------------------------------
% Output
%
% am [numeric]: The array manifold/steering vector of the array for the
% directions/angles and wavenumbers provided. The dimensions
% of the argument are MxNxK where M is the number of sensors,
% N the number of directions/angles and K the number of
% frequencies/wavenumbers.
%
% --------------------------------------------------
% Notes
%
% --------------------------------------------------
function am = arrMan(mPos, dirs, k)
% ====================================================
% Check for number of arguments
% ====================================================
narginchk(3, 3);
nargoutchk(0, 1);
% ====================================================
% Validate input arguments
% ====================================================
% Validate mandatory arguments
validateattributes(mPos, "numeric", {'2d', 'finite', 'nonnan', 'nonempty', 'real', 'ncols', 3}, mfilename, "Position of sensors", 1);
validateattributes(dirs, "numeric", {'2d', 'finite', 'nonnan', 'nonempty', 'real', 'ncols', 2}, mfilename, "Directions of interest", 2);
validateattributes(k, "numeric", {'vector', 'finite', 'nonnan', 'nonempty', 'nonnegative', 'real'}, mfilename, "Wavenumbers of interest", 3);
% =============================================
% Calculate the array manifold
% =============================================
% Get Cartesian coordinates of directions
[x, y, z] = sph2cart(dirs(:, 1), dirs(:, 2), ones(size(dirs(:, 1))));
% Inner product of directions and sensor position
am = mPos * [x, y, z].';
% Multiply with wavenumbers
am = am .* permute(k(:), [3, 2, 1]);
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment