Skip to content
Snippets Groups Projects

Convert project to use column vectors

Merged Imported Achilles Kappis requested to merge ColPosVecs into main
14 files
+ 305
348
Compare changes
  • Side-by-side
  • Inline

Files

@@ -3,7 +3,7 @@
@@ -3,7 +3,7 @@
% Author: Achilles Kappis
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
% e-mail: axilleaz@protonmail.com
%
%
% Date: 28/05/2024 (DD/MM/YYYY)
% Date: 29/09/2024 (DD/MM/YYYY)
%
%
% Copyright: MIT
% Copyright: MIT
% --------------------------------------------------
% --------------------------------------------------
@@ -13,12 +13,12 @@
@@ -13,12 +13,12 @@
% Input
% Input
%
%
% mPos [numeric]: The positions of the sensors in Cartesian coordinates.
% mPos [numeric]: The positions of the sensors in Cartesian coordinates.
% This must be an Mx3 matrix where M denotes the number of
% This must be an 3xM matrix where M denotes the number of
% sensors and for each sensor the coordinates are in
% sensors and for each sensor the coordinates are in
% [x, y, z] format.
% [x; y; z] format.
%
%
% dirs [numeric]: These are the directions for which the array manifold
% dirs [numeric]: These are the directions for which the array manifold
% will be calculated. This must be an Nx2 matrix where N is
% will be calculated. This must be an 2xN matrix where N is
% the number of directions and for each direction the
% the number of directions and for each direction the
% azimuth and elevation/inclination is given. The values
% azimuth and elevation/inclination is given. The values
% must be provided in radians. The directions must be
% must be provided in radians. The directions must be
@@ -53,18 +53,18 @@ function am = arrMan(mPos, dirs, k)
@@ -53,18 +53,18 @@ function am = arrMan(mPos, dirs, k)
% Validate input arguments
% Validate input arguments
% ====================================================
% ====================================================
% Validate mandatory arguments
% Validate mandatory arguments
validateattributes(mPos, "numeric", {'2d', 'finite', 'nonnan', 'nonempty', 'real', 'ncols', 3}, mfilename, "Position of sensors", 1);
validateattributes(mPos, "numeric", {'2d', 'finite', 'nonnan', 'nonempty', 'real', 'nrows', 3}, mfilename, "Position of sensors", 1);
validateattributes(dirs, "numeric", {'2d', 'finite', 'nonnan', 'nonempty', 'real', 'ncols', 2}, mfilename, "Directions of interest", 2);
validateattributes(dirs, "numeric", {'2d', 'finite', 'nonnan', 'nonempty', 'real', 'nrows', 2}, mfilename, "Directions of interest", 2);
validateattributes(k, "numeric", {'vector', 'finite', 'nonnan', 'nonempty', 'nonnegative', 'real'}, mfilename, "Wavenumbers of interest", 3);
validateattributes(k, "numeric", {'vector', 'finite', 'nonnan', 'nonempty', 'nonnegative', 'real'}, mfilename, "Wavenumbers of interest", 3);
% =============================================
% =============================================
% Calculate the array manifold
% Calculate the array manifold
% =============================================
% =============================================
% Get Cartesian coordinates of directions
% Get Cartesian coordinates of directions
[x, y, z] = sph2cart(dirs(:, 1), dirs(:, 2), ones(size(dirs(:, 1))));
[x, y, z] = sph2cart(dirs(1, :), dirs(2, :), ones(size(dirs(1, :))));
% Inner product of directions and sensor position
% Inner product of directions and sensor position
am = mPos * [x, y, z].';
am = [x; y; z] * mPos;
% Multiply with wavenumbers
% Multiply with wavenumbers
am = am .* permute(k(:), [3, 2, 1]);
am = am .* permute(k(:), [3, 2, 1]);
Loading