I am trying to create a random frequency spectrum, and then use ifft to find the corresponding time-domain vector.
I am using the following code:
for i = 1:64 randNum = (rand() + 1i * rand())/sqrt(2); % Needs to be normalized by sqrt(2) randFreq(i) = randNum; end randVec = ifft(randFreq);
Note that I know mvnrnd , however for technical reasons I need to use a for loop and generate each element individually. I also need to generate a random frequency spectrum, and then use the inverse transform, I can not directly generate a random vector in the time domain.
If I draw a random vector value ( plot(abs(randVec)) ), I always get a graph of this form.

There is always a surge in n=0 , and all other elements are much smaller in magnitude. I was hoping for some understanding of why this is happening.
My question is not a duplicate. Creating random values ββin vector Matlab , these are completely different questions, which, as it turned out, are on the same topic. I specifically ask about the behavior of my ifft . This is not a duplicate of the surge in my inverse Fourier transform . In this matter, the spike may be caused by some data identity, however in my case the data is completely random.
source share