I'm trying to understand the difference between applying the Discrete Cosine Transform (DCT) and the Inverse Discrete Fourier Transform (IDFT) to the log Mel-filterbank energies as explained in the answer here. So, I tried the following pretty simple example in MATLAB:
x1 = [1. 2. 3.];
X1 = fft(x1);
x2 = ifft(abs(X1));
x3 = ifft(x1);
The classes of the results are:
Why do x2 and x3 have two different classes?
Update:
Here is the file 'myVoice.wav' in the following test:
[signal, fs] = audioread('myVoice.wav');
segmentLength = 240;
x = signal(20490 : 20490 + segmentLength - 1);
x = x .* hamming(segmentLength);
res = ifft(abs(fft(x)) .^ 2);

x2is typedoublebecause the magnitude ofX1is no longer complex. Same logic goes forx3, it is computed by taking the inverse FFT of a complex vector so it too is complex – Engineer Feb 10 '20 at 20:17complex(x, 0)to the real vectors and there you go, they are now complex – Engineer Feb 10 '20 at 20:40ifftfunction return vectors of two different classes in this example! Also, when I appliedifftto the power spectrum (a real-valued vector) of a speech window, it returns a real-valued vector instead of a complex-valued vector, while the answer in the attached link said: "after applying theifftwe get complex-valued coefficients". – Abdulkader Feb 10 '20 at 20:55