Hi,
Hermitian symmetry ensures that the inverse FFT of a frequency-domain vector yields a real-valued time signal. In MATLAB, you create this by setting the negative frequency components as the complex conjugate and flipped version of the positive frequencies.
For an even length ( N ):
N = 8;
X = zeros(1,N);
X(1) = rand; % Real DC component
X(2:N/2) = rand(1,N/2-1) + 1i*rand(1,N/2-1); % Positive freqs
X(N/2+1) = rand; % Real Nyquist
X(N/2+2:N) = conj(flip(X(2:N/2))); % Hermitian symmetry
x = ifft(X); % Real-valued signal
For an odd length ( N ):
N = 9;
X = zeros(1,N);
X(1) = rand; % Real DC
X(2:(N+1)/2) = rand(1,(N-1)/2) + 1i*rand(1,(N-1)/2);
X((N+1)/2+1:N) = conj(flip(X(2:(N+1)/2)));
x = ifft(X);
This ensures x is real-valued due to Hermitian symmetry in X.
Hope this helps!