calculate the Schroeder energy decay curve:
조회 수: 8 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Nipun
2024년 6월 7일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Seismology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!