I can't get the Spectrogram to work, could anyone help please, I have attached my code?
조회 수: 6 (최근 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에서 Time-Frequency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!