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

5 visualizaciones (últimos 30 días)
Louise Wilson
Louise Wilson el 26 de Jul. de 2019
Comentada: Louise Wilson el 27 de Jun. de 2024
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 comentarios
Louise Wilson
Louise Wilson el 27 de Jun. de 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 el 27 de Jun. de 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 :)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Parametric Spectral Estimation en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by