calculate the Schroeder energy decay curve:
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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);
0 Kommentare
Antworten (1)
Nipun
am 7 Jun. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Seismology finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!