How do I create a frequency waterfall plot from an impulse response?

22 visualizzazioni (ultimi 30 giorni)
Hi,
I am using the following code to plot magnitude from an impulse response. I would like to plot a waterfall showing amplitude over frequency over time, but I can't seem to make it work.
If anyone could suggest a solution that would be incredibly helpful.
Thanks
info = audioinfo('IR.wav');
Fs = 44100;
[y,Fs] = audioread('IR.wav');
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
NFFT = length(y);
Y = fft(y,NFFT);
Fy = ((0:1/NFFT:1-1/NFFT)*Fs).';
magnitude = abs(Y);
dB_mag=mag2db(magnitude);
figure(1)
plot(Fy(1:NFFT/2),dB_mag(1:NFFT/2))

Risposte (1)

Navya Seelam
Navya Seelam il 8 Ago 2019
Use waterfall function to obtain waterfall plot.
t=0:1/Fs:info.Duration;
t= t(1:end-1)';
Z=[dB_mag(1:NFFT/2) Fy(1:NFFT/2) t1(1:NFFT/2)];
waterfall(Z)
However, the magnitude obtained from fft corresponds to a particular frequency and does not have any time stamp. So, the magnitude obtained from fft can be used to visualize amplitude over frequency but not amplitude over time or frequency over time.

Community Treasure Hunt

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

Start Hunting!

Translated by