diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 2b62a91f9654f063612a7c523dc44a0639a5f08b..0000000000000000000000000000000000000000 --- a/CHANGELOG +++ /dev/null @@ -1,2 +0,0 @@ -v0.1.0 -This is the initial version of the project. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..103f892ddb5b1400f8a5e5097ba3f06672148001 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,51 @@ +### v0.2.0 ### +**Utilities** ++ Added a single papameter bisection method. +* Improved rotation matrix calculation function with degrees and radian calculations available. ++ Added function to calculate a double-sided spectrum from a single-sided spectrum. ++ Added a function to calculate the intersection of three vectors. ++ Added a pair of functions to check for even or odd elements. ++ Added a function to pick values from a vector based on given probabilities. ++ Added a function to pick randomly unique rows from a matrix. ++ Added a Heaviside step function. ++ Added function to swap argument values. + +**Optimisation** ++ Added a MATLAB Memetic Algorithm (MA) implementation. +* The algorithm calls provided functions and can solve generic problems. + +**Control** ++ Added tonal control in the frequency domain. +* Control is contained in a single function. +* Can be used with or without virtual sensing. +* Implementations of optimal control and FxLMS (still frequency domain) calculations are available. + +**Signal Processing - Array Processing** ++ Added array manifold (steering vector) calculation function. + +**Signal Processing - Generic** ++ Added frequency band calculation function with 1/1 octave and 1/3 octave bands. ++ Add fractional delay filter impulse response generation function. + +**Virtual Sensing - Generic** ++ Added a multiple coherence calculation function. + +** Virtual Sensing - Remote Microphone Technique** +* Divide the observation filter and estimation with observation filter in two functions. The return arguments are split appropriately to the function they relate. ++ Added option to include noise in the monitoring microphone power spectral density matrix with specified SNR value. + +**Sound Fields** ++ Added plane wave calculation function. ++ Added Circular Harmonics calculation function. ++ Added Spherical Harmonics calculation function. ++ Added Discrete Circular Fourier Transform (DCFT) calculation function. ++ Added Inverse Discrete Circular Fourier Transform (IDCFT) calculation function. ++ Added Discrete Spherical Fourier Transform (DSFT) calculation function. ++ Added Inverse Discrete Spherical Fourier Transform (IDSFT) calculation function. ++ Added function to extrapolate a sound field in the Spherical Harmonics domain. ++ Added function to calculate sound field generated by a point source in the Spherical Harmonics domain (truncated order). ++ Added function to calculate sound field generated by a plane wave in the Spherical Harmonics domain (truncated order). + + +### v0.1.0 ### +* This is the initial version of the project. diff --git a/README.md b/README.md index a9f801e0ef7c062dfeb16cdeb986d5e40bd02d5a..c330960bb71a4afaad6583734be7460af9e4c1af 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ The project is licensed under the ***MIT License***, which is a rather unrestric ## Versioning ## -The project uses [semantic versioning](https://semver.org/) and the current version is **v0.1.0**. +The project uses [semantic versioning](https://semver.org/) and the current version is **v0.2.0**. #### **Important** -If you are unable, or do not want to contribute under this license please do **not** contribute to this project at all. All content within the project must be under the same license. \ No newline at end of file +If you are unable, or do not want to contribute under this license please do **not** contribute to this project at all. All content within the project must be under the same license. diff --git a/Virtual Sensing/README.md b/Virtual Sensing/README.md index 5f866e1e3f5cb5d9c987318a4100dc86f80d855d..973f143b5cfa557145038cd44a3427bbce70b40e 100644 --- a/Virtual Sensing/README.md +++ b/Virtual Sensing/README.md @@ -40,7 +40,7 @@ Pm = ptSrcField(vPos, mPos, 7.5e2); % Primary-to-monitoring transfer function (f Pe = ptSrcField(vPos, ePos, 7.5e2); % Primary-to-virtual transfer function (f = 750 Hz) % Perform estimation and acquire the normalised square estimation error -Oopt = obsFilt(Pe, Pm, [], 1e2); % Use regularisation factor 100 to calculate the observation filter +Oopt = obsFilt(Pe, Pm, [], 1e2, 15); % Use regularisation factor 100 to calculate the observation filter and add noise with Signal-to-Noise Ratio of 15 dB. [~, ~, ~, normSqrErr] = obsFileEst(Pm, Oopt, Pe, []); % Perform estimation ``` @@ -50,4 +50,4 @@ None. ## References -[1] A. Roure, A. Albarrazin, *"The remote microphone technique for active noise control"*, Inter-Noise and Noise-Con Congress and Conference Proceedings, Active99, Fort Lauderdale FL, pp. 1233-1244(12). \ No newline at end of file +[1] A. Roure, A. Albarrazin, *"The remote microphone technique for active noise control"*, Inter-Noise and Noise-Con Congress and Conference Proceedings, Active99, Fort Lauderdale FL, pp. 1233-1244(12). diff --git a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m index f95f34d4bc611b76dbecce0797eb8523aa5330ff..587921d5b4da379e8a9bcc8a294a8093ec45fdfe 100644 --- a/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m +++ b/Virtual Sensing/Remote Microphone Technique/MATLAB/Functions/obsFilt.m @@ -3,7 +3,7 @@ % Author: Achilles Kappis % e-mail: axilleaz@protonmail.com % -% Date: 15/08/2024 (DD/MM/YYYY) +% Date: 01/09/2024 (DD/MM/YYYY) % % Copyright: MIT % -------------------------------------------------- @@ -36,6 +36,17 @@ % regularisation factor for all microphones. % [Default: 0] % +% snrVal [numeric] (Optional): This is the Root-Mean-Square (RMS) +% Signal-to-Noise Ratio (SNR) in the +% monitoring microphone signals. This must +% be either a scalar indicating the common +% SNR value of the microphone signals, or a +% vector of dimensions Kx1, containing the SNR +% values of each microphone. The values must +% be real or Inf for the noiseless case. See +% the Notes below for references on how this +% value is calculated. [Default: Inf] +% % -------------------------------------------------- % Output % @@ -59,12 +70,16 @@ % -------------------------------------------------- % Notes % +% - The SNR at the monitoring microphones calculation is based on the +% paper: "Combining the remote microphone technique with head-tracking +% for local active sound control" by W. Jung, S. J. Elliott and J. Cheer. +% % -------------------------------------------------- -function [oOpt, Sme, Smm, condNum] = obsFilt(Pe, Pm, srcCsd, regFacs) +function [oOpt, Sme, Smm, condNum] = obsFilt(Pe, Pm, srcCsd, regFacs, snrVal) % ==================================================== % Check for number of arguments % ==================================================== - narginchk(2, 4); + narginchk(2, 5); nargoutchk(0, 4); % ==================================================== @@ -92,6 +107,21 @@ function [oOpt, Sme, Smm, condNum] = obsFilt(Pe, Pm, srcCsd, regFacs) regFacs = 0; end + if nargin > 4 && ~isempty(snrVal) + validateattributes(snrVal, "numeric", {'vector', 'real', 'nonnan', 'nonempty'}, mfilename, "Normalised Root-Mean-Square Singal-to-Noise Ratio of the monitoring microphones", 5); + + % Make sure snrVal has correct dimensions + if ~isscalar(snrVal) && numel(snrVal) ~= size(Pm, 1) + error("SNR must be either a scalar or its length must match the number of monitoring microphones."); + end + + if sum(snrVal == -Inf) > 0 + error("SNR value cannot be equal to -Inf"); + end + else + snrVal = Inf; + end + % ==================================================== % Calculate optimal filters @@ -102,14 +132,24 @@ function [oOpt, Sme, Smm, condNum] = obsFilt(Pe, Pm, srcCsd, regFacs) Sme = Pe * tmpVal; % Virtual-Monitor mics cross-spectra Smm = Pm * tmpVal; % Monitor-Monitor mics cross-spectra + % Regularisation matrix if isscalar(regFacs) - regMat = eye(size(Smm)) .* regFacs; % Regularisation matrix + regMat = eye(size(Smm)) .* regFacs; else regMat = diag(regFacs); end + % Signal-to-Noise Ratio at the monitoring microphones + if ~isinf(snrVal) + snrVal = 10^(-snrVal/10); % Convert deciBel to linear + snrMtx = (snrVal.^2) .* norm(Smm, 'fro')/(size(Pm, 1)^2); % Calculate the appropriate SNR amplitude values + else + snrMtx = 1; + end + snrMtx = snrMtx .* eye(size(Pm, 1)); + % Calcualte observation filters - invQty = Smm + regMat; + invQty = Smm + snrMtx + regMat; oOpt = Sme/invQty; % Condition number of auto-correlation (power spectrum) matrix