I've created ifft of signal:

Wf=[0 zeros(1,19) conj(W) zeros(1,6000) flip((W)) zeros(1,19)];

Now take a look at freqz(w) or frequency reponse of ifft ed version: enter image description here And freqs_plot(1:length(W),W) simple amplitude and phase of frequency domain signal: freq domain

As you can see the phases are the same except they are inverted, why? Codes has been ran using GNU Octave.

  • 1
    $\begingroup$ I believe that both MATLAB and GNU Octave actually place the negative frequencies after the positive ones. This means that for your frequency response vector Wf, the phase of the positive frequencies (which are treated as the “actual phase” of your signal) is the phase of conj(W), which is what you get from freqz(w). You can try conjugating the right part of the spectrum instead of the left, like conj(flip(W)) and most probably you’ll get the results you seek (the “correct” phase). $\endgroup$
    – ZaellixA
    Commented Oct 19, 2023 at 10:54
  • $\begingroup$ @ZaellixA You are right, THX, how we can understand which one is right? the conj must be on which side? $\endgroup$ Commented Oct 22, 2023 at 6:55
  • $\begingroup$ @ZaellixA You are right. I've made my code compatible with your idea by replacing phases=0:PHASE_RES:2*pi; with phases=0:-PHASE_RES:-2*pi;. This forced the output frequency coefficients to be inverted phase, it worked! answer my Q if you could I will accept it from my heart. $\endgroup$ Commented Oct 22, 2023 at 8:41

1 Answer 1



You should remove the conjugation of $W$ on the left half of your frequency vector and add it to your right half. For more insight as to why this has to be done read the rest of the answer.

Discrete Fourier Transform

I gloss over some mathematical details, but if the reader is interested there are many textbooks with that as well as answers here on Signal Processing SE.

The Discrete Fourier Transform (DFT) “assumes" the spectrum is periodic with period $N$ in samples, where $N$ is the number of elements in the signal vector. This means that there is a repetition of the spectrum every $N$ samples towards $\pm \infty$.

For real (time-domain) signals, the magnitude spectrum is an even function (mirrored) and the phase an odd function (mirrored and negated). This is expressed as

$$ \begin{align} \vert W \left( \omega \right) \vert & = \vert W \left( - \omega \right) \vert \tag{1.a} \label{1.a}\\ \angle W \left( \omega \right) & = - \angle W \left( - \omega \right) \tag{1.b} \label{1.b} \end{align} $$

Combining equations \eqref{1.a} and \eqref{1.b} to represent the spectrum in complex number notation this becomes

$$ W \left( \omega \right) = W^{*} \left( - \omega \right) \tag{2} \label{2} $$

where $\left[ ~ \cdot ~ \right]^{*}$ denotes complex conjugation.

Since the spectrum is periodic, the negative-frequencies part of the spectrum $W \left( - \omega \right)$ will also be present on the right of the positive-frequencies part of it. Thus, one could easily decide to use this part of the periodic spectrum instead of the negative-frequencies part on the left of the positive frequencies, as the information is identical.

In practice, this is what many computational packages (like MATLAB and Octave) do. They actually place the negative-frequencies part of the spectrum after the positive-frequencies part. In many cases, since the information in the negative frequencies is redundant (except for a negation of frequency) for real-valued time-domain signals, you could even choose to discard that part entirely. This is actually what your W vector seems to hold.

Keep in mind that whatever the information in the negative-frequencies part is, it is needed to be able to convert your signal from the frequency domain back to the time domain, whether it will lie on the right or left of the positive-frequencies part (which you seem to know too).

Solution to the problem

Since you seem to be using MATLAB/Octave you should structure your frequency domain signal vector in the format the ifft() function expects it to be. This is negative frequencies after the positive ones. You seem to have done the magnitude spectrum correctly by flipping W, which is the half “non-redundant” part of the spectrum, but then you conjugate the left part of the vector. which corresponds to the real frequencies.

The positive frequencies will give the actual phase characteristics to your time-domain signal, so you end up with an inverted/negated phase, as can be seen from the result of freqz()` which “correctly” (based on the convention of where the positive and negative frequencies lie in the spectrum) calculates the phase.

The solution to that would be to complex conjugate the right half of your spectrum vector instead of the left to end up with

Wf = [0 zeros(1, 19), W zeros(1, 6000) conj(flip(W))) zeros(1, 19)];

This should result in the correct frequency vector and the results of freqz() should now match that of your original W vector.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.