Commit c35d3d30 authored by Mueller-Trapet's avatar Mueller-Trapet

added spectrum adaptation terms from ISO 717-1

parent b7f70de6
...@@ -13,17 +13,21 @@ sArgs = struct('pos1_data','anything','bandsperoctave',3,'freqVector',[],'create ...@@ -13,17 +13,21 @@ sArgs = struct('pos1_data','anything','bandsperoctave',3,'freqVector',[],'create
%% reference curves %% reference curves
if strcmpi(sArgs.type,'iso') % Reference curve and frequencies according to ISO 717-1 if strcmpi(sArgs.type,'iso') % Reference curve and frequencies according to ISO 717-1
outputStr = 'R_W'; outputStr = 'R_w (C; C_{tr})';
roundingFactor = 0.1; roundingFactor = 0.1;
deficiencyLimit = Inf; deficiencyLimit = Inf;
if sArgs.bandsperoctave == 1 if sArgs.bandsperoctave == 1
refCurve = [36 45 52 55 56]-52;
freq = [125 250 500 1000 2000]; freq = [125 250 500 1000 2000];
refSurf = 10; refSurf = 10;
refCurve = [36 45 52 55 56].'-52;
Ccurve = [-21 -14 -8 -5 -4].';
Ctrcurve = [-14 -10 -7 -4 -6].';
elseif sArgs.bandsperoctave == 3 elseif sArgs.bandsperoctave == 3
freq = [100,125,160,200,250,315,400,500,630,800,1000,1250,1600,2000,2500,3150]; freq = [100,125,160,200,250,315,400,500,630,800,1000,1250,1600,2000,2500,3150].';
refCurve = [33 36 39 42 45 48 51 52 53 54 55 56 56 56 56 56]-52;
refSurf = 32; refSurf = 32;
refCurve = [33 36 39 42 45 48 51 52 53 54 55 56 56 56 56 56].'-52;
Ccurve = [-29 -26 -23 -21 -19 -17 -15 -13 -12 -11 -10 -9 -9 -9 -9 -9].';
Ctrcurve = [-20 -20 -18 -16 -15 -14 -13 -12 -11 -9 -8 -9 -10 -11 -13 -15].';
else else
error([upper(mfilename) ':wrong input for bandsperoctave']); error([upper(mfilename) ':wrong input for bandsperoctave']);
end end
...@@ -32,14 +36,12 @@ elseif strcmpi(sArgs.type,'astm') % Reference curve and frequencies according to ...@@ -32,14 +36,12 @@ elseif strcmpi(sArgs.type,'astm') % Reference curve and frequencies according to
roundingFactor = 1; roundingFactor = 1;
deficiencyLimit = 8; deficiencyLimit = 8;
sArgs.bandsperoctave = 3; sArgs.bandsperoctave = 3;
freq = [125,160,200,250,315,400,500,630,800,1000,1250,1600,2000,2500,3150,4000]; freq = [125,160,200,250,315,400,500,630,800,1000,1250,1600,2000,2500,3150,4000].';
refCurve = [-16 -13 -10 -7 -4 -1 0 1 2 3 4 4 4 4 4 4]; refCurve = [-16 -13 -10 -7 -4 -1 0 1 2 3 4 4 4 4 4 4].';
refSurf = 32; refSurf = 32;
else else
error([upper(mfilename) ':wrong input for type']); error([upper(mfilename) ':wrong input for type']);
end end
freq = freq(:);
refCurve = refCurve(:);
dbStep = 1; dbStep = 1;
%% prepare data %% prepare data
...@@ -52,45 +54,62 @@ if ~isa(data,'itaSuper') ...@@ -52,45 +54,62 @@ if ~isa(data,'itaSuper')
end end
end end
freqVector = data.freqVector; freqVector = data.freqVector;
soundInsulation = 20.*log10(interp1(freqVector,data.freqData(:,1),freq,'spline','extrap')); soundReduction = 20.*log10(interp1(freqVector,data.freqData(:,1),freq,'spline','extrap'));
if min(freqVector) > freq(1) || max(freqVector) < freq(end) if min(freqVector) > freq(1) || max(freqVector) < freq(end)
warning([upper(mfilename) ': Sound insulation data will be extrapolated']); warning([upper(mfilename) ': Sound insulation data will be extrapolated']);
end end
%% sound insulation index %% sound insulation index
soundInsulation = round(soundInsulation/roundingFactor)*roundingFactor; soundReduction = round(soundReduction/roundingFactor)*roundingFactor;
soundInsulationIndex = min(floor(soundInsulation-refCurve)); soundReductionIndex = min(floor(soundReduction-refCurve));
delta = max(0,refCurve + soundInsulationIndex - soundInsulation); delta = max(0,refCurve + soundReductionIndex - soundReduction);
counter = 0; % stopping criterion counter = 0; % stopping criterion
% shift reference curve until limits are reached % shift reference curve until limits are reached
while sum(delta) < refSurf && all(delta <= deficiencyLimit) && counter < 1e3 while sum(delta) < refSurf && all(delta <= deficiencyLimit) && counter < 1e3
soundInsulationIndex = soundInsulationIndex + dbStep; soundReductionIndex = soundReductionIndex + dbStep;
delta = max(0,refCurve + soundInsulationIndex - soundInsulation); delta = max(0,refCurve + soundReductionIndex - soundReduction);
counter = counter+1; counter = counter+1;
end end
soundInsulationIndex = soundInsulationIndex - dbStep; soundReductionIndex = soundReductionIndex - dbStep;
delta = max(0,refCurve + soundInsulationIndex - soundInsulation); delta = max(0,refCurve + soundReductionIndex - soundReduction);
deficiencies = itaResult(delta,freq,'freq')*itaValue(1,'dB'); deficiencies = itaResult(delta,freq,'freq')*itaValue(1,'dB');
deficiencies.allowDBPlot = false; deficiencies.allowDBPlot = false;
%% adaptation terms for ISO
if strcmpi(sArgs.type,'iso')
C = round(-10.*log10(sum(10.^((Ccurve - soundReduction)./10),1)) - soundReductionIndex);
Ctr = round(-10.*log10(sum(10.^((Ctrcurve - soundReduction)./10),1)) - soundReductionIndex);
else
C = 0;
Ctr = 0;
end
%% output %% output
if sArgs.createPlot if sArgs.createPlot
fgh = ita_plot_freq(data); fgh = ita_plot_freq(data);
plotResult = itaResult([10.^((refCurve+soundInsulationIndex)./20), [ones(sum(freq<=500),1)*10.^(soundInsulationIndex./20); nan(sum(freq>500),1)]],freq,'freq'); plotResult = itaResult([10.^((refCurve+soundReductionIndex)./20), [ones(sum(freq<=500),1)*10.^(soundReductionIndex./20); nan(sum(freq>500),1)]],freq,'freq');
ita_plot_freq(plotResult,'figure_handle',fgh,'axes_handle',gca,'hold'); ita_plot_freq(plotResult,'figure_handle',fgh,'axes_handle',gca,'hold');
bar(gca,deficiencies.freqVector,deficiencies.freq,'hist'); bar(gca,deficiencies.freqVector,deficiencies.freq,'hist');
[maxDef,maxIdx] = max(deficiencies.freq); [maxDef,maxIdx] = max(deficiencies.freq);
legend({'Sound transmission loss','Shifted reference curve',[outputStr ' = ' num2str(soundInsulationIndex) 'dB'],['Deficiencies (sum: ' num2str(sum(deficiencies.freq)) 'dB, max: ' num2str(maxDef) 'dB at ' num2str(deficiencies.freqVector(maxIdx)) 'Hz)']}); if strcmpi(sArgs.type,'iso')
ylim([0 max(max(soundInsulation),max(refCurve)+soundInsulationIndex)+15]); singleNumberString = [outputStr ' = ' num2str(soundReductionIndex) ' (' num2str(C) '; ' num2str(Ctr) ') dB'];
else
singleNumberString = [outputStr ' = ' num2str(soundReductionIndex) 'dB'];
end
legend({'Sound transmission loss','Shifted reference curve',singleNumberString,['Deficiencies (sum: ' num2str(sum(deficiencies.freq)) 'dB, max: ' num2str(maxDef) 'dB at ' num2str(deficiencies.freqVector(maxIdx)) 'Hz)']});
ylim([0 max(max(soundReduction),max(refCurve)+soundReductionIndex)+15]);
end end
varargout{1} = soundInsulationIndex; varargout{1} = soundReductionIndex;
% reference curve specified at the freqVector specified by the input itaResult: % reference curve specified at the freqVector specified by the input itaResult:
if nargout >= 2 if nargout >= 2
varargout{2} = interp1(freq, 10.^((refCurve+soundInsulationIndex)./20), freqVector, 'linear'); varargout{2} = interp1(freq, 10.^((refCurve+soundReductionIndex)./20), freqVector, 'linear');
if nargout == 3 if nargout >= 3
varargout{3} = deficiencies; varargout{3} = deficiencies;
if nargout >= 4
varargout{4} = [C,Ctr];
end
end end
end end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment