# frequency domain to time domain with magnitude and phase

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

• if z is your frequency domain vector, then X is your time domain vector. Done! Where's the issue? – Marcus Müller Sep 10 '20 at 19:33
• 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 – bugroackold Sep 10 '20 at 20:12
• 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. – Marcus Müller Sep 10 '20 at 20:15
• 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 – bugroackold Sep 10 '20 at 20:30
• ... How about you add the original signal, and your X so that we can actually try to understand what you want? – 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.

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