Question about taking fft of a set of real values, laying positive values of the vector, followed by 0, followed by negative values

1 view (last 30 days)
I have the 1-dimensional FPU problem, and I have the following code:
YX(IT,1:N+1)=[0 Y(IT,1:N )];
sXF(IT,:)=imag(fft([YX(IT,1:N+1) 0 -YX(IT,N+1:-1:2)]))/sqrt(2*(N+1));
I am trying to understand why the positive values of YX, are laid with 0 and the negative values before taking the fft?
I tried to look in the matlab documentation for fft, and I see the following under "Compute the two-sided spectrum P2. Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L."
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1)
I see the signal is doubled here. Why is this done? And perhaps these two are unrelated questions.

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!