I can't get the Spectrogram to work, could anyone help please, I have attached my code?
3 次查看(过去 30 天)
显示 更早的评论
Hi, I have recorded audio using the data acquisition toolbox and I am now wanting to analyse my results in the frequency domain with time on the y-axis.
'AvgL' is the averaged signal of the audio from the left speaker and then I have taken the FFT of it multiplied by the FFT of the original driving audio signal.
I then unwrapped the FFT ('HL') to give me the phase delay. But I am unsure how to view it in the spectrogram with the frequency against time?
Fs = 44100;
Ns = 32767; % length of audio signal
f = (0:Ns-1)*(Fs/Ns);
t = ((0:Ns-1)/Fs)*2;
xfft_L = fft(AvgL'); % FFT of the average of the recorded audio signal
dfft = fft(org_mls); % FFT of the original audio signal
HL = xfft_L./dfft; % FFT
Phi = unwrap(angle(HL)); % Phase Response
omega = 2*pi*f;
PD_L = -Phi./omega';
Could any one please help? Really appreciate it :)
0 个评论
回答(1 个)
Cindy Solomon
2015-4-21
Hi Sarah,
Assuming that you want to see the spectrogram of the signal "AvgL", there is actually already a function to do this in MATLAB without you expressly having to find the FFT, etc. The doc page for this function is here, but typing:
spectrogram(AvgL)
should calculate and display this for you. Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio Processing Algorithm Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!