I'm looking into active noise cancellation and I am little confused about something. I read that the maximum theoretical cancellation is determined by the coherence of the reference signal ($ x $) and noise at the cancellation point ($ d $). In particular, the maximum noise reduction is given by:
$ G_{max} = -10\log_{10} [1-C_{dx}] $
Where $C_{dx}$ is the magnitude squared coherence function of the two signals.
I have recordings of uniform white noise recorded at the two locations ($ x $ and $ d $) and have been playing around in Matlab. What I see is that $ G_{max} $ varies depending FFT size, as shown here for FFT sizes 2¹² to 2¹⁴.
Where this gets more confusing is if I compare this theoretical max to the cancellation afforded by a simple NLMS, simulated in matlab (FFT size = 8192):
The trace for the NLMS is the PSD of the error divided by the PSD of $ d $, once the NLMS filter has converged.
I'm pretty sure my calculation of $C_{dx} $ is correct, but here's my Matlab code in case:
% N = fft size
% L = signal length
nBlocks = floor(L/N);
Sxx = zeros(N, 1);
Syy = Sxx;
Sxy = Sxx;
for i = 1 : nBlocks
X = fft(x((i-1)*N+1 : i*N));
Y = fft(y((i-1)*N+1 : i*N));
Sxx = Sxx + (X .* conj(X));
Syy = Syy + (Y .* conj(Y));
Sxy = Sxy + (X .* conj(Y));
end
Sxx = Sxx / nBlocks;
Syy = Syy / nBlocks;
Sxy = Sxy / nBlocks;
Cxy = abs(Sxy).^2 ./ (Sxx .* Syy);
Should I expect to see change of coherence with FFT size?