4
$\begingroup$

I came across some matlab code as the below,

fftout   = fft(adc_in, 1024); 
fftout_p = fftout.*conj(fftout);

I think fftout is formatted as complex form. from here I'm ok.

Next stage that signal is multiplicated by itself which is conjugated.

I think it means that it want to get the real number not complex number.

From here, I'm not sure and want to know that practically what does Imaginary part affect to real signal processing?

Can we ignore like above that?

In real practically engineer field, What do conjugating and Imaginary part mean and affect to the real engineer field?

$\endgroup$
  • $\begingroup$ It looks like someone was interested in the squared magnitude of the FFT output. That line eliminates the imaginary part which carries the phase. Is this the sort of answer you are looking for? $\endgroup$ – hops Jan 26 '18 at 7:16
  • $\begingroup$ @hops : Thanks for reply. I want to know what if we eliminates(just delete, conjugating, double it) the imaginary part from fft output, what affect to the output, and when do we use these methods such as eliminating the imaginary part . Can we call it as a squared magnitude? $\endgroup$ – start01 Jan 26 '18 at 7:54
  • $\begingroup$ For an intuitive introduction to complex numbers and Euler's Equation, which is central to understanding the DFT, I recommend that you read my blog article called "The Exponential Nature of the Complex Unit Circle" which can be found here: dsprelated.com/showarticle/754.php $\endgroup$ – Cedron Dawg Jan 26 '18 at 14:14
8
$\begingroup$

The real part represents cosine correlation, and the imaginary coefficient represent the sine correlation. Cosines are even or symmetric functions in the DFT aperture, and sines are odd functions (or anti-symmetric) in the DFT aperture. So you can only ignore the imaginary coefficients for exactly symmetric input.

Conjugation and multiplication is “just” a mathematical trick (identity) to compute sin^2 + cos^2 which is the hypotenuse squared (Pythagoras).

$\endgroup$
  • 1
    $\begingroup$ Thank you so much, From "So you can only ignore the imaginary coefficients for exactly symmetric input." I'd like to understand about exactly symmetric input. Could you give me any link for referencing that? $\endgroup$ – start01 Jan 26 '18 at 12:23
  • $\begingroup$ If x(N-i) == x(i) for all samples in DFT (length N) input vector x, the the data is mirror symmetric. Any variation from this symmetry (in strictly real input) will show up in some odd (or imaginary) components of an FFT result. $\endgroup$ – hotpaw2 Jan 26 '18 at 15:15
  • $\begingroup$ Might be this will be a different question but not sure. I'm only confused that what is the difference to get real part between by using conjugation and by using abs function(matlab). As I know usually we use abs function of matlab to get the magnitude of fft. but now we know the conjugating is used for getting the real part. $\endgroup$ – start01 Jan 28 '18 at 13:45
  • $\begingroup$ Conjugating and multiplying is the same as taking the square of the magnitude (= abs()^2). Both provide a real result. But getting the real part only is a different operation. $\endgroup$ – hotpaw2 Jan 28 '18 at 15:31
7
$\begingroup$

In addition to the other answers that explain the maths, it may be of interest to you to know why this might be useful.

Calculating the squared magnitude like this is useful because, due to the Wiener-Khinchin theorem, the result will be spectrum of the autocorrelation function, which you can then ifft to get the autocorrelation function itself. This is done in other answers here, e.g. Efficiently calculating autocorrelation using FFTs

If you instead take the logarithm before doing an ifft, you get the cepstrum, which is frequently used in e.g. speech analysis

$\endgroup$
2
$\begingroup$

The clue is in the _p. The guy wanted the power spectral density (PSD). A display of $10log_10(PSD)$ is the traditional spectrum analyzer display (be sure to average about 20 PSD's before displaying though).

$\endgroup$
0
$\begingroup$

As you already suspected, a complex number times its conjugate equals the squared magnitude. So you do not throw away the imaginary part, you throw away the phase:

$$z\cdot z^*=(z_R+jz_I)(z_R-jz_I)=z_R^2+z_I^2=|z|^2$$

where $z$ is some complex number, and $z_R$ and $z_I$ are its real and imaginary parts, respectively.

$\endgroup$
  • $\begingroup$ Dear @Matt, Thanks.Would you help me to understand more, I'm wondering about " the squared magnitude" mean. $\endgroup$ – start01 Jan 26 '18 at 8:01
  • $\begingroup$ @start01: Do you know what the magnitude of a complex number is? Squaring means multiplying it with itself. Try to read some basics about complex numbers, otherwise you'll have serious problems working in DSP. $\endgroup$ – Matt L. Jan 26 '18 at 8:22
  • 1
    $\begingroup$ Sorry, In a minute, I miss read and understand about squared magnitude. $\endgroup$ – start01 Jan 26 '18 at 8:26
-1
$\begingroup$

Any Fourier Transform (and in particular the DFT computed by the FFT) contains information regarding the amplitude and phase of signals (or amplitude and phase response of systems). The output of the Fourier Transform has a complex number associated to every frequency considered. This complex number has a magnitude and phase. The magnitude corresponds to the amount a (complex) sinusoidal component at that frequency will be amplified (or attenuated). The phase angle of the complex number corresponds to the phase shift that will be observed by passing a (complex) sinusoidal component at that frequency.

For example, if I have a frequency response at frequency $f_0$ of $1 + j$ and I pass a signal $x(t) = \exp(j 2 \pi f_0 t)$ through the system, then the output observed will be $y(t) = \sqrt{2} \exp(j 2 \pi f_0 t + j\frac{\pi}{4})$. This is a direct consequece of the fact that $1 + j = \sqrt{2}\exp(j\frac{\pi}{4})$. This is the information that you receive from the FFT.

By multiplying the FFT output by its conjugate, you are losing the phase information and obtaining the square of the magnitude information. Sometimes, this is all you are after. Presumably, this is the case in the algorithm code that you are reading.

Note that the magnitude and phase are real numbers. I believe this answers your question. Please let me know if you still have confusion.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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