impulse response interpretation
13 views (last 30 days)
Show older comments
Hi to everybody,
I have implemented a little function that calculates the impulse response from a complex dataset (FR_data).
I am trying to test how different FR_data influnce the impulse response so I plot the FR_data over frequency using plot(frequency,abs(FR_data)) and after I ran the routine and plot the results again using plot(time,abs(y)).
the routine looks like:
function y=IR(FR_data)
L=length(FR_data);
Y=zeros(1,2*length(FR_data));
Y(2:L+1)=FR_data;
Y(L+2:end)=fliplr(FR_data(1:end-1));
y=ifft(Y);
end
I notice that when I boost the higher frequencies in my FR_data the peak of the impulse response gets closer to time 0 and increases in amplitude and is somehow shorter. When I boost the low frequencies then the peak of the impulse response gets further away from time 0, decreases in amplitude and is wider.
Can anybody enlighten me please on if this is normal behaviour?
Furthermore, all the impulse responses exhibit a very very short and sharp maximum amplitude on time 0 (actually it extends for 2-3 samples, then dies out and then the impulse response follows. Is there a way to interpret this?
Any input would be greatly appreciated.
thank you for your patience
A small addition that might explain better what I am talking about. My datasets looks like: https://picasaweb.google.com/106674205971471180972/Matlab?authkey=Gv1sRgCKjU47ij4922SQ#5743069984065489538 they represent complex data that extend from 1 Hz to 20 kHz with a step of 1 Hz. So 20000 data. When I plot abs of those in a semilogx I get: https://picasaweb.google.com/106674205971471180972/Matlab?authkey=Gv1sRgCKjU47ij4922SQ#5743069982822662066. They represent 3 different FR_data sets. The x axis represents frequency.
After I run my routine I get IRs that look like: https://picasaweb.google.com/106674205971471180972/Matlab?authkey=Gv1sRgCKjU47ij4922SQ#5743069982995627554 and a zoomed version in the beginning of the x axis to actually see the IRs: https://picasaweb.google.com/106674205971471180972/Matlab?authkey=Gv1sRgCKjU47ij4922SQ#5743070000860043586 The x axis here represents the samples (not the time).
1 Comment
Dr. Seis
on 15 May 2012
A note of clarification (only because I helped in a previous post: http://www.mathworks.com/matlabcentral/answers/38316-obtain-the-impulse-response-from-a-frequency-response) is that FR_data represents the non-zero, positive frequency amplitude values in the frequency domain.
I would make one small modification to your function (just so it is more applicable to other situations in the future). Change your line from "fliplr(FR_data(1:end-1))" to "fliplr(conj(FR_data(1:end-1)))" in order to account for the possibility that FR_data is complex (instead of only real valued).
The fact that your pulse gets narrower with a larger contribution of high frequencies or wider with a larger contribution of low frequencies seems normal. But.. is it possible that you post a picture of "plot(time,y)" (without the "abs") or copy/paste the values associated with a high-frequency and low-frequency version of "FR_data" ?
Answers (3)
buscuit
on 15 May 2012
3 Comments
Dr. Seis
on 16 May 2012
Those impulse responses do look a bit strange. Are those still plotted using "plot(time,abs(y))" or "plot(time,y)" with no ABS? I think it will be easier for me to diagnose if you either A) copy/paste the complex FR_data into another answer here or B) supply the function that was used to create the FR_data.
Dr. Seis
on 17 May 2012
I reran through the process of generating the Frequency Response data (G) using your code and the one from the FEX just to see if there could have been any steps that were not properly handled in converting it to the time-domain... but I still got the same bizarre looking Impulse Response you provided pictures of. As I am not familiar with the type of FR function you are using, I cannot really comment on why the shape looks so bizarre... but I can tell you that the "spike" at your first time-domain data sample is basically equal to mean(real(G)). This is simply a consequence of having real frequency amplitudes that have a static shift, in this case they are all pretty much centered around 1... so you get a spike with amplitude 1 at your first time-domain data sample. If you were to subtract your frequency-domain data by 1, you would get rid of this spike in the time-domain.
Not sure if I have any other helpful advice if you are expecting a different shaped IR in the time domain without knowing where this FR formulation is coming from.
*******************
EDIT
******************
I forgot to mention, that I would change your :
f=1:res:20000;
to:
f=res:res:20000;
because your first non-zero frequency will not always be 1 (only when res=1 is that valid).
I am only going to add the next bit just so you can double check the way you create your symmetric frequency response data (a little more general than my previous post):
If:
[G,f]=planeFR(wx,wy,h,res);
Then:
N = numel(G); % number of non-zero, positive frequency amplitudes
df = (f(end)-f(1))/(N-1); % frequency increment
Nyq = f(end); % Nyquist frequency
Fs = 2*Nyq; % Sample frequency
%Fs = 2*N*df; %<--- should be same as above
newN = 2*N; % Number of samples in the full frequency response spectrum
%newN = Fs/df; %<--- should be same as above
newG = zeros(newN,1); % Pre-allocate full spectrum array
newG(2:1+N) = G; % populate non-zero, positive frequency amplitudes
newG(2+N:end) = fliplr(conj(G(1:end-1))); % neg. frequency amplitudes
% newG = newG - mean(real(newG)); %<---- remove that spike in time-domain
% newG = newG*Fs; %<---- correct time-domain amplitudes
newf = -Nyq : df : Nyq-df;
% Plot Frequency Response
% figure; plot(newf, abs(newG));
% Plot Impulse response
t = (0:newN-1)/Fs; % time
g = ifft(newG);
figure; plot(t,g);
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!