Hello!!
I want to calculate the signal energy in rolling windows, after first normalizing to interval [-1,1].
Firstly, I wrote the below code to read and sound the signal.
[y,Fs] = audioread('viola_series.wav');
plot(y);
title('Audio viola series.wav');
sound(y,Fs);
How to do the normalization?
Thanks in advance

 Réponse acceptée

Adam Danz
Adam Danz le 23 Jan 2021
Audio data are typically already normalized between [-1,1]. Are you getting values outside of that range?
min(y)
max(y)
Anyway, this is how to normalize any vector to [-1,1];
ynorm = (y-min(y))/range(y)*2-1;

5 commentaires

RoBoTBoY
RoBoTBoY le 24 Jan 2021
Modifié(e) : RoBoTBoY le 24 Jan 2021
So that is the initial signal
And that is the normalized signal
How could I convert the x axis from 0 to 10 sec for both signals?
Adam Danz
Adam Danz le 24 Jan 2021
Modifié(e) : Adam Danz le 24 Jan 2021
Data from the first plot could also be normalized but without values larger than +/- ~0.025.
Data from the second plot are also normalized and consume the full normalized range.
> How could I convert the x axis from 0 to 10 sec for both signals?
You can use the same approach in my answer except multiply by 10 instead of 2 and no need to subtract 1.
RoBoTBoY
RoBoTBoY le 24 Jan 2021
Modifié(e) : RoBoTBoY le 24 Jan 2021
I could not do it. But it does not matter.
Now 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.
syms m
w = hamming(1001);
energy_signal = symsum(conv(y_norm.^2,w),m,0,10);
plot(energy_signal);
How to do that?
The normalization to [0,10] would have been
n = (x-min(x))/range(x)*10;
Adam Danz
Adam Danz le 24 Jan 2021
Since you're new question differs greatly from the original one, it would be better to post it as a new question.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by