I have a signal magnitude and phase in frequency domain. I need to have it in time domain but I really have no idea how to do it. I heard something about mirroring the signal but I'm kinda new at this. I have tried to do something like this in matlab but I'm clearly missing the point. And how do I define the time vector?

z = A .* exp(i*phase);
X = ifft(z);

I've attached the signal plot https://i.stack.imgur.com/FfbTV.jpg

  • $\begingroup$ if z is your frequency domain vector, then X is your time domain vector. Done! Where's the issue? $\endgroup$ – Marcus Müller Sep 10 '20 at 19:33
  • $\begingroup$ I am really new to fourier transform and I've read that it's not enough to simply do ifft, that I have to mirror of these phase and magnitude values - it's all really hazy for me and X doesn't produce the results I seek. Thank you for your response $\endgroup$ – bugroackold Sep 10 '20 at 20:12
  • $\begingroup$ but it really is the time domain if z is your frequency domain. There's really nothing ambiguous about that. It's kind of hard to help you understand the things you've read "somewhere" and understand what you seek when all you tell us what you don't seek. Please explain why this isn't what you need, and what you've read. $\endgroup$ – Marcus Müller Sep 10 '20 at 20:15
  • $\begingroup$ Well I plot it and it's near nowhere the original signal so something is clearly wrong with what I've done here. Thank you for your response $\endgroup$ – bugroackold Sep 10 '20 at 20:30
  • $\begingroup$ ... How about you add the original signal, and your X so that we can actually try to understand what you want? $\endgroup$ – Marcus Müller Sep 10 '20 at 20:33

Okay, I don't use MATLAB, but I think this Python example represents what you may be asking.

import numpy as np

A = 3 + 4j
k = 5
N = 128

Z = np.zeros(N, dtype='complex')
Z[k]   = A
Z[N-k] = np.conj( A )

z = np.fft.ifft(Z)

print( z )

This will generate a real valued pure tone (all the imaginary values are zero to the limit of precision) signal with 5 cycles in the frame. The "mirroring" means that for a real signal the DFT is a conjugate mirror image, i.e. $Z[k] = Z^*[N-k]$. It is common convention to use X, but I like Z too.

  • $\begingroup$ yeah, you have defined the mirroring part perfectly! thank you kindly $\endgroup$ – bugroackold Sep 10 '20 at 21:57

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.