필터 지우기
필터 지우기

Impulse response acoustic information calculator

조회 수: 2 (최근 30일)
Bill Tate
Bill Tate 2020년 7월 6일
댓글: Mark Thompson 2020년 8월 6일
Hello can someone help me. I can not figure out how to get this code to run. it is supposed to estimate reverberation time based on room size and absorption. It returns a error of invalidcoeff: abs_coeff so I see a probelm in the first line but I do not understand what to do about it. I tried putting numbers in but the code did not like that either. Can anyone tell me what i am doing wrong? :
function rt = rtEst(abs_coeff,room,formula)
%RTEST Estimate reverberation time based on room size and absorption
%
% RT = IOSR.ACOUSTICS.RTEST(ABS_COEFF,ROOM) estimates the reverberation
% time (RT60) for a shoebox-shaped room, with average absorption
% coefficient ABS_COEFF, and dimenions ROOM=[L W H] (in metres). An RT
% estimate is returned for each element of ABS_COEFF.
%
% RT = IOSR.ACOUSTICS.RTEST(ABS_COEFF,ROOM,FORMULA) allows the formula to
% be specified. The options are 'sabine' (default), or 'eyring'.
% Copyright 2016 University of Surrey.
assert(isnumeric(abs_coeff), 'iosr:rtEst:invalidCoeff', 'abs_coeff should be numeric')
assert(isnumeric(room) & numel(room)==3 & isvector(room), 'iosr:rtEst:invalidRoom', 'room should be a 3-element numeric vector')
if nargin<3
formula = 'sabine';
end
assert(ischar(formula), 'iosr:rtEst:invalidFormula', 'formula should be a character array (string)')
l = room(1);
w = room(2);
h = room(3);
vol = prod(room);
surf_area = (2*l*w) + (2*l*h) + (2*w*h);
switch lower(formula)
case 'sabine'
rt = (0.161*vol)./(surf_area.*abs_coeff);
case 'eyring'
rt = (0.161*vol)./(-surf_area.*log(1-abs_coeff));
otherwise
error('iosr:rtEst:unknownFormula','Unknown formula')
end
end
  댓글 수: 1
Mark Thompson
Mark Thompson 2020년 8월 6일
Can you please post your code for how you call this function? I have just tested it with several different scenario's and the only time I get it to generate the error you are experiencing is when I pass a "non-numeric" value as the absorption coefficient?!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulation, Tuning, and Visualization에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by