I can't get the Spectrogram to work, could anyone help please, I have attached my code?

6 Ansichten (letzte 30 Tage)
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 :)

Antworten (1)

Cindy Solomon
Cindy Solomon am 21 Apr. 2015
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!

Kategorien

Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by