Total energy in Time and Frequency Dimain

3 ビュー (過去 30 日間)
Maria Amr
Maria Amr 2020 年 12 月 12 日
編集済み: Paul 2024 年 11 月 10 日
I truly appreciated if somebody can direct me how to measure total energy in a certain frequency band?
I have a signal and use this code to measure total enery and the result is reasonable.
E1_timedomain=sum(abs(x.^2))
but it measuers total energy of whole signal. I just want to measure it between [0-100] Hz. Appreciared!

採用された回答

Star Strider
Star Strider 2020 年 12 月 12 日
If you have R2018a or later, and the Signal Processing Toolbox, use the bandpass function to selectively filter the frequencies-of-interest. Then do whatever calculations you want to do on the output. If you have an earlier version, it is easy to design filters in MATLAB. I will help you with that, if necessary.
  2 件のコメント
Maria Amr
Maria Amr 2020 年 12 月 12 日
Star Strider Thank you so much.
As usual, the best and the fast way.BIG like!
Star Strider
Star Strider 2020 年 12 月 12 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (3 件)

Maria Amr
Maria Amr 2020 年 12 月 14 日
Star Strider I have applied a bandpass filter and get a reasonable result. Would you please direct me how may I retrive the filtered signal? Appreciated!
that is my code:
bandpass(amp1,[1 78],fs);
  1 件のコメント
Star Strider
Star Strider 2020 年 12 月 14 日
You need to use an output:
filtered_signal = bandpass(amp1,[1 78],fs);

サインインしてコメントする。


Maria Amr
Maria Amr 2020 年 12 月 14 日
Star Strider Appreciated!
  1 件のコメント
Star Strider
Star Strider 2020 年 12 月 14 日
As always, my pleaure!
(Also, in the future please post comments as Comments, not Answers.)

サインインしてコメントする。


Paul
Paul 2024 年 11 月 10 日
編集済み: Paul 2024 年 11 月 10 日
Define a real-valued, finite duration signal of length N, assumed to be uniformly spaced samples collected as Fs = 2000 Hz
rng(100);
N = 1000;
x = randn(1,N); Fs = 2000; Ts = 1/Fs;
The total energy in this signal is computed in the time domain as
E = sum(abs(x).^2)
E = 1.0063e+03
The total energy computed in the frequency domain is (taking advantage of the symmetry in the frequency domain because x is real-valued)
X = @(f) freqz(x,1,f,Fs);
E = 2*integral(@(f) abs(X(f)).^2,0,Fs/2)*Ts
E = 1.0063e+03
Hence, the energy in the signal between 0-100 Hz is
E100 = 2*integral(@(f) abs(X(f)).^2,0,100)*Ts
E100 = 95.8129
Can also approximate E100 from the DFT samples.
Xdft = fft(x);
fdft = (0:N-1)/N*Fs;
E100 = 2*sum(abs(Xdft(fdft<=100)).^2)/N
E100 = 99.5646
Or better yet
E100 = 2*trapz(fdft(fdft<=100),abs(Xdft(fdft<=100)).^2)/Fs
E100 = 94.7997
Can also apply a very sharp, low pass filter to x and then compute the energy in the filter output as a rough approximation
y = lowpass(x,100,Fs,'Steepness',0.95);
sum(abs(y).^2)
ans = 112.4906

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by