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

Merge branch 'ObsFiltUpdate' into 'main'

SNR in observation filter calculation feature and repository version update

See merge request in-nova/in-nova!1
parents 131e4e23 16807700
No related branches found
No related tags found
1 merge request!1SNR in observation filter calculation feature and repository version update
v0.1.0
This is the initial version of the project.
\ No newline at end of file
### 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.
......@@ -72,7 +72,7 @@ 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**
......
......@@ -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
```
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment