I am trying to estimate the Spectral Correlation Function by the FFT Accumulation Method (FAM) in Matlab. The way I understand the FAM method is as this link (see page 6 & 7 for FAM tutorial).
Here is the image again summarizing the process:
I'll summarize how I am understanding this method below:
- Acquire a data chunk, of
size = Ndata points.
- Have the user enter in the desired frequency resolution (
d_f), and desired alpha resolution (
d_alpha, calculate the following parameters.
N' = fs/d_f;
fsis sampling frequency of input signal.
N'turns out to be the STFT FFT size.
L = N'/4, where L is the STFT skip (see diagram in link). P = fs/(L*d_a), which is the smoothing FFT size .. and finally
N = P*L,
Nis the total number of data points we are going to process.
Nshould be nextpow2 > the input size and zero padded if necessary.
I have the code to chunk up the data into segments of
N' data points, perform windowing for each of those chunks, compute the FFT of each of those chunks, and perform the downshift to baseband. I store the complex baseband into a matrix called XD. The dimensions of XD are:
N' rows X
P cols, where each col represents the STFT for a chunk. Then, I perform the following operations:
XD = conj(XD'); % now dim(XD) = P x N'. we do this b/c FFT operates on columns in a matrix in matlab.
The steps I am confused about in the FAM method are the multiplication of X with its complex conjugate, performing the time smoothing w/ the P point FFT, and then outputting the SCF.
To perform the multiplication w/ the complex conjugate, I do the following:
% Np = N' (in code). XM = zeros(P, Np^2); for k=1:Np for l=1:Np XM(:,(k-1)*Np+l) = (XD(:,k).*conj(XD(:,1))); end end
Essentially this operation is creating a matrix XM with dimensions of
(N')^2. After this, I do an FFT on XM
XM2 = fft(XM);
Now what do I do? I have to essentially select certain values from XM2 as my SCF estimate, but am confused on how to go about doing this? Each row in XM contains the spectral correlation between different frequency bins. So for example, column 1 of XM contains the spectral correlation of bin1 with bin1, col 2 contains spectral correlation of bin1 with
N' contains the spectral correlation between bin1 and
N'+1 contains the spectral correlation between
bin1, etc etc... That is the reason that XM has dimensions of
I'm confused as to which of these points I need to select in order to create my SCF estimate. I essentially need to figure out which elements of XM correspond to a certain alpha and freq value, but I don't know how to do that.
Thanks in advance, and happy new years!