How to calculate PSD estimate of acoustic data in 1Hz bins? pwelch?

6 visualizzazioni (ultimi 30 giorni)
Hi everyone,
I have several files of 118.5 second duration that I would like to calculate the PSD of. I want to do this in 1Hz frequency bins, with Hanning window and 50% overlap, and have considered using pwelch.
First I calibrate the data and then have tried to work out how to use pwelch to no avail so far:
path=('C:\Users\datafolder');
d=dir(fullfile(path, '*.wav')); %list all .wav files in path folder
files=length(d); %number of files in folder
for i=1:files %for each file
disp(d(i).name);
filename=fullfile(path, d(i).name); %get full filename
[xbit, fs]=audioread(filename); %and then sampled data and sampling
%freq (fs) from audioread function
cal=-176.2;
cal=power(10, cal/20); %calibration correction factor
calxbit=xbit*cal; %apply calibration
end
[pxx,f]=pwelch(calxbit, window, 0.5, [], 144e3);
How do I specify that I want to use 1Hz bins? My data is sampled at 144kHz.
Thanks!!
  4 Commenti
Louise Wilson
Louise Wilson il 27 Giu 2024
Thanks @Mathieu NOE - that is indeed what I did in the end. It takes a long time but is the resolution I need. I also applied the calibration factor on pxx, by converting pxx to dB. :)
Louise Wilson
Louise Wilson il 27 Giu 2024
Thanks @Michael Ladegaard - sorry, I did not realise your comment was also recent :). In the end I did account for the three points you mention, but I am sure your solution is more elegant! I will refer back to it. Thanks a lot :)

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by