How to implement IDFT using the positive frequencies of DFT, modulation and resampling on MATLAB? This question is a continuation of the discussion at How can a linear operator on DFT vector produce the same vector using only half of the DFT vector?, where the higher level motivation is better explained, in case there is interest.

Question:

How to take the positive frequencies from an hermitian symmetric DFT vector, take the IDFT of this (which is complex), multiply by a carrier to shift the spectrum, resample, take the real part of it, and obtain the same IDFT result as the result that would be obtained by the IDFT of the original hermitian symmetric symbol?

Details:

I would really appreciate to have my understanding and the concepts I mention checked.

Consider that the DFT vector $\mathbf{X}$ of a certain signal is hermitian symmetric and represents a bandwidth of $B$ Hz. If I consider a signal represented by the positive frequencies (from DC to Nyquist), it is the same as shifting the positive side of the spectrum, and centralizing it at frequency 0. Now, the new spectrum is not hermitian symmetric anymore, yields a complex IDFT and represents a Bandwidth of $\frac{B}{2}$.

To use a numerical example, for $N=8$, considering from DC to Nyquist, that would give 5 positive frequencies and 3 negative. Then, I would shift the 5 DFT samples (correspondent to the positive frequencies) to the center of the spectrum. In this case, the new DFT size would be odd, and the Nyquist frequency (at k= 5/2 = 2.5) wouldn't fall on a DFT sample 

At this point, I have a signal bandlimited to $\frac{B}{2}$. Then, if I multiply this signal with a carrier of frequency $\frac{B}{2}$, I shift the spectrum again to the positive and negative side, such that the original spectrum is reconstructed. However, since this operation would increase the bandwidth back to $B$ Hz, the product $x[n]*c[n]$ would need to have its sampling frequency increased by a factor of 2, so that the frequency spectrum can actually represent the spectrum of the signal without aliasing.

The carrier should be an exponential:

\begin{align}
c[n] = e^{j2\pi n k_0/N}
\end{align}
where $k_0$ is the number of DFT samples to shift. In this case, $k_0 = \frac{N}{2}$, such that:
\begin{align}
c[n] = e^{j \pi n}
\end{align}

Finally, after doing resampling, I should take the real part of the signal and that should be equal to the original IDFT (the one obtained by simpling taking the IDFT of the original hermitian symmetric symbol).

However, I am confused mainly by the following issues:


From DC to Nyquist there are 5 DFT samples. That would yield a complex IFFT with size 5, Then, I would multiply point-wise by 5 samples of the carrier and upsample by 2, resulting in 10 samples. On the other hand, the original IDFT has length 8.
I'm not sure about the rationale behind taking the real part.
I'm not sure if the exponential is the correct carrier.


MATLAB implementation:

Here is the code I'm trying to make work.

N=4;
A=rand(N-1,1) + j*rand(N-1,1); % Random positive carrier
X=[0; A; 0; flipud(conj(A))]; % Hermitian symmetric DFT vector

x = ifft(X)

% Positive side of the spectrum shifted to the center
Xp = [X((N/2 + 1):N+1); X(1:N/2);];

% Complex IFFT:
xp = ifft(Xp);

% Carrier
n=(0:N);
k0 = (N+1)/2;
carrier = exp(j*2*pi*k0*n/(N+1)).';

% Modulation
x_up = xp.*carrier;

% Increase the sampling rate by a factor of two
x_re = resample(x_up,2,1); 

real(x_re)


I basically want the two vectors that are printed to the workspace to be equal: x and real(x_re)
Here is the IDFT with normal and positive only frequencies if it helps:

N=4;
A=rand(N-1,1) + j*rand(N-1,1);   % Random positive carrier
X=[0; A; 0; flipud(conj(A))];    % Hermitian symmetric DFT vector
Xp=[0; 2*A; 0; zeros(size(A))];  % Positive freq only DFT vector

x = ifft(X);         % Normal IDFT
xa = ifft(Xp);       % Analytic signal
xp = real(ifft(Xp)); % Same as normal IDFT