计算时域数据的能量

dan*_*hjo 5 matlab signal-processing fft dft

我是数字信号处理的新手.我有以下传感器样本数据

Time(milliseconds)            data
------------------    -------------------
0                     0.30865225195884705   
60                    0.14355185627937317   
100                  -0.16846869885921478   
156                  -0.2458019256591797    
198                  -0.19664153456687927
258                   0.27148059010505676   
305                  -0.16949564218521118   
350                  -0.227480947971344 
397                   0.23532353341579437   
458                   0.20740140974521637
Run Code Online (Sandbox Code Playgroud)

这意味着在时间上0我有价值,0.30865225195884705并且在时间上60我有价值0.14355185627937317等等.

从每个传感器获取数据10 milliseconds.所以,我假设采样率应该设置为100 Hz.

我想计算时域信号的总能量.

我读到它可以使用Parseval定理计算如下:

在此输入图像描述

其中X[k]DFTx[n],二者的长度N.

有任何建议,如何使用MATLAB计算总能量?

Sle*_*Eye 6

Parseval定理在将时域能量与频域链接时很有用.但是,如果您不需要在频域中执行其他计算,则可以使用以下方法直接在时域中计算能量:

Energy = sum(abs(x).^2)
Run Code Online (Sandbox Code Playgroud)

另一方面,如果出于其他原因需要将信号转换到频域,您也可以使用(根据Parseval定理)计算能量:

Xf = fft(x); % compute the DFT (using the Fast Fourier Transform)
Energy = sum(abs(Xf).^2) / length(Xf); % Get the energy using Parseval's theorem
Run Code Online (Sandbox Code Playgroud)