obtain the Impulse response from a frequency response

104 views (last 30 days)
Hi everybody,
I need some help to get me started on this one:
I have a transfer function (a frequency response) that is generated by two datasets. I need to convert this frequency response (FR) to the time domain (I guess by using the ifft function in Matlab) in order to obtain the impulse response (IR) and see how long it is in seconds.
What confuses me is if an impulse (IR) has N samples then the fft would have N/2+1 samples (please correct me if I am wrong). The rest of the samples in the FR are disregarded as they are symmetrical.
Now, if I have the FR I could go back to IR by ifft. But that would give me only N/2+1 samples. I need N for the impulse response. How do I deal with this?
Moreover, how can I determine the sampling frequency (fs) of my FR in order to calculate the duration of the IR in seconds? My FR expands from 20 to 10000 Hz with a step of 20 Hz. Is it in this case that fs=20?
thank you for your patience

Accepted Answer

Dr. Seis
Dr. Seis on 14 May 2012
N = 1000; % Number of samples
df = 20; % Frequency increment (in Hertz)
Nyq = 10000; % Nyquist Frequency (in Hertz)
Two ways of determining Fs, but both should be same answer:
Fs = 2*Nyq; % Sampling frequency (20000 samples/sec)
Fs = N*df; % Sampling frequency (20000 samples/sec)
The real part of your frequency response is symmetrical (i.e., the real part of your FR is symmetrical about 0 frequency). The imaginary part of your frequency response is anti-symmetrical (i.e., the imaginary part of your FR is symmetrical about 0 frequency if you were to multiply one side by -1).
If you make sure you have frequency response amplitudes that corresponds to frequencies:
f = -Nyq : df : Nyq-df;
Then you can convert it into the timedomain using:
IR_data = ifft(ifftshift(FR_data));
Though there might be some scaling factor you will need to multiply the ifft result to (I think just multiply the result by Fs).
*******************
EDIT 05/14/2012
*******************
If you only have real, positive frequency data... then that's all you got. Imaginary parts are all zero, so that is fine... you have data with zero phase. You will still need to create a symmetrical dataset (i.e., "FR_data"). In order to create your "FR_data" dataset, you will take your current dataset, say "FR_positive_frequency_only" and do this:
FR_data = zeros(1,1000);
FR_data(2:501) = FR_positive_frequency_only;
FR_data(502:1000) = fliplr(FR_postive_frequency_only(1:end-1));
These amplitudes correspond to frequencies according to:
f_shift = ifftshift(f);
Your impulse response dataset is then just:
IR_data = ifft(FR_data); % No need to use ifftshift when constructing FR_data like above
Here the amplitude at 0 frequency (i.e., FR_data(1)) is just set to zero. Note: if your "FR_positive_frequency_only" dataset is a column matrix, then use flipud instead of fliplr.
  1 Comment
evelyn
evelyn on 7 May 2024
I have CFR from OFDM system (measured by real world WIFI system). And the subcarrier/frequency index is about -N, -(N-1),...,0,...(N-1),N. It seems that the real/imaginery part of the frequency response do not be symmetrical. Should I apply ifftshift before I apply ifft to convert frequency response to impulse response?
Thanks~

Sign in to comment.

More Answers (1)

buscuit
buscuit on 14 May 2012
Elige, thanks for the input.
Thank you for the reply on the frequency question. So, my sampling frequency should be the double of the Nyquist frequency which is the highest frequency of my dataset (10000 Hz in my case).
Apart from that, it seems I only have one part of the symmetrical FR you are talking about, as it is not symmetrical about 0 frequency. My data start from 20 Hz and go to 10000 Hz in steps of 20 Hz. This is the only data I have. All real and positive.
So according to what you mentioned I would guess that I have to replicate from this dataset the symmetrical about the 0 frequency. Did I get you right?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!