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

23 次查看(过去 30 天)
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))

回答(1 个)

Navya Seelam
Navya Seelam 2019-8-8
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.

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by