Effacer les filtres
Effacer les filtres

Issue creating a probability density function for audio file

2 vues (au cours des 30 derniers jours)
Erik J
Erik J le 7 Fév 2020
Commenté : Erik J le 9 Fév 2020
Hello. Thank you in advance.
I want to generate probability density functions of amplitudes from audiofiles. However, when I use the pdf function, I get a vector of NaNs, and I do not know why. It seems to me it should be a very simple code, so I am not sure what I am missing here. See below.
[f,fs] = audioread('sound_file.wav'); %read in audio
x = sum(f,2); %average 2 channels to get single vector
y = pdf('Normal',x); %get PDF values

Réponse acceptée

Walter Roberson
Walter Roberson le 7 Fév 2020
Normal distribution expects two parameters, the mean and the standard deviation. The defaults for those parameters are both 0, so Normal distribution with 0 mean and 0 standard deviation. But 0 standard deviation on a normal distribution leads to NaN for all values.

Plus de réponses (0)

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by