calculate the Schroeder energy decay curve:

25 visualizaciones (últimos 30 días)
Hyungeun Yun
Hyungeun Yun el 9 de Feb. de 2021
Respondida: Nipun el 7 de Jun. de 2024
I am trying to understand these questions,
i have wav file and how could i make "for loop" and how could i make formula
1.Calculate the total energy present in the whole RIR as above. You will need to use a “for loop”.
2.Create an empty array of zero values that is the same length as the RIR file (in samples):
EDC = zeros(1,length(RIR));
3.Create a “for loop” to count from sample n = 1 (the start of the file) to sample n = N (the end of the file).
4.On each iteration of the for loop, calculate the energy level remaining in the RIR and save it to EDC sample ‘n’.
EDC(n) = sum(RIR(n:end).^2);

Respuestas (1)

Nipun
Nipun el 7 de Jun. de 2024
Hi Hyungeun,
I understand that you want to calculate the total energy in a WAV file using a "for loop" in MATLAB. Here is how you may do it, based on the shared information:
% Load the RIR file
[RIR, fs] = audioread('your_file.wav');
% Calculate the total energy in the RIR
totalEnergy = sum(RIR.^2);
% Create an empty array for EDC
EDC = zeros(1, length(RIR));
% Calculate the energy decay curve
for n = 1:length(RIR)
EDC(n) = sum(RIR(n:end).^2);
end
% Optionally, plot the EDC
plot(EDC);
title('Energy Decay Curve');
xlabel('Sample');
ylabel('Energy');
Hope this helps.
Regards,
Nipun

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by