How to find the energy of a discrete signal?

30 ビュー (過去 30 日間)
RoBoTBoY
RoBoTBoY 2021 年 1 月 24 日
回答済み: Shubham Khatri 2021 年 2 月 5 日
I want to find the energy of this signal in rolling windows.
Note that the energy of a signal x[n] overlapping by a window w[n] is given by the following formula:
where as signal w[n] I will use the Hamming window given by the equation:
I will use window length N = 1000 samples.
I run the below code but without result.
[y,Fs] = audioread('viola_series.wav');
figure(26);
plot(y);
title('Audio viola series.wav');
sound(y,Fs);
N = 1000;
% Normalization
min(y);
max(y);
y_norm = (y-min(y))/range(y)*2-1;
figure(27);
plot(y_norm);
title('Normalized audio viola series.wav');
syms m
w = hamming(1001);
energy_signal = symsum(conv(y_norm.^2,w),m,0,10);
plot(energy_signal);
How to do that?
Thanks in advance
  3 件のコメント
RoBoTBoY
RoBoTBoY 2021 年 1 月 25 日
Can you be more detailed?
Walter Roberson
Walter Roberson 2021 年 1 月 25 日
w = 0.54 + 0.46 * cos(2*pi*(0:n)/N);
E = conv(x.^2, w, 'valid')
or perhaps it should be 'same' instead of 'valid'.

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

回答 (1 件)

Shubham Khatri
Shubham Khatri 2021 年 2 月 5 日
Hello,
You can remove the syms and symsum from the code and directly use convolution. Please take a look at the following code. For more information please refer to the documentation for conv here.
[y,Fs] = audioread('viola_series.wav');
figure(26);
plot(y);
title('Audio viola series.wav');
sound(y,Fs);
N = 1000;
% Normalization
min(y);
max(y);
y_norm = (y-min(y))/range(y)*2-1;
figure(27);
plot(y_norm);
title('Normalized audio viola series.wav');
w = 0.54 + 0.46 * cos(2*pi*(0:n)/N);
energy_signal = conv(x.^2, w, 'valid');
plot(energy_signal);
Hope it helps

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by