MATLAB中的光谱熵计算


9

如何在MATLAB中计算信号的谱熵?我知道基本的步骤,但是如果有人可以提供帮助,那就太好了,

  1. 使用MATLAB中的FFT命令计算信号的功率谱。
  2. 使用功率谱或任何其他技术计算功率谱密度。
  3. 正常化之间的功率谱密度,使得它可以作为一个概率密度函数来处理p [01个]p一世
  4. 计算熵Hs=-p一世日志2p一世

至于Matlab代码,请尝试在此处询问dsprelated.com/code.php
2013年

这与频谱平坦度或维纳熵相同吗? dsp.stackexchange.com/q/2045/29
endolith 2013年

Answers:


9

从技术上讲,这不是MATLAB式的论坛,但是我可以为您更详细地说明这些步骤:假设您的输入信号为,其DFT为X f 。对于真实信号,您可以使用单面DFT,因为当您查看其功率谱密度时,另一半将是多余的。(PSD)。X[ñ]XF

|XF|2

P小号dñ

P小号dñF=P小号dFF=-Fs2F=Fs2P小号dF

最后,您的频谱熵将为:

Ë=-F=-Fs2F=Fs2P小号dñFØG2[P小号dñF]

5

我只是在这里

我的源代码:

    [x, Fs, nbits] = wavread('ederwander.wav'); 


    winSize = 2048;

    n_samples = length(x);


    %50% overlap or 0 to not use overlap
    OverlapStep = 50;

    if OverlapStep > 0

        Overlap = floor((OverlapStep*winSize) / 100); 
        nFrames=floor(n_samples/Overlap)-1; 
    else
        Overlap= winSize;
        nFrames=floor(n_samples/Overlap)-1;
    end

    Entropy = zeros(nFrames,1);

    k=1;
    inc=1;

    while ( (k+winSize-1) <= n_samples )

        FrameSignal = x(k:k+winSize-1);

        v = FrameSignal .* hann(length(FrameSignal));           

        N = length(v);

        Y=fft(v);

        % Compute the Power Spectrum
        sqrtPyy = ((sqrt(abs(Y).*abs(Y)) * 2 )/N);
        sqrtPyy = sqrtPyy(1:winSize/2);



       %Normalization
       d=sqrtPyy(:);
       d=d/sum(d+ 1e-12);

       %Entropy Calculation
       logd = log2(d + 1e-12);
       Entropy(inc) = -sum(d.*logd)/log2(length(d));


       k=k+Overlap;
       inc=inc+1;
end

此源代码从每个框架块执行光谱熵计算...

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.