Aufgrund einer Wartung wird GitLab am 28.09. zwischen 10:00 und 11:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 28.09. between 10:00 and 11:00 am.

Commit 6bf10a5e authored by Mueller-Trapet's avatar Mueller-Trapet

bugfixes and additional implementation of ATSM version

parent 5a4b0eed
......@@ -8,91 +8,94 @@ function varargout = ita_soundInsulationIndexAirborne(varargin)
%% input parsing
sArgs = struct('pos1_data','anything','bandsperoctave',3,'freqVector',[],'createPlot',false);
sArgs = struct('pos1_data','anything','bandsperoctave',3,'freqVector',[],'createPlot',false,'type','ISO');
[data,sArgs] = ita_parse_arguments(sArgs,varargin);
%% additional parameters
if sArgs.bandsperoctave == 3
refSurf = 32;
elseif sArgs.bandsperoctave == 1
refSurf = 10;
else
error([upper(mfilename) ':wrong input for badnsperoctave']);
end
refFreq = 500;
%% reference curves
if sArgs.bandsperoctave == 1
refCurve = [36 45 52 55 56]; % Reference curve according to ISO 717-1
freq = [125 250 500 1000 2000]; % Frequencies according to ISO 717-1
lFreq = length(refCurve);
if strcmpi(sArgs.type,'iso') % Reference curve and frequencies according to ISO 717-1
outputStr = 'R_W';
roundingFactor = 0.1;
deficiencyLimit = Inf;
if sArgs.bandsperoctave == 1
refCurve = [36 45 52 55 56]-52;
freq = [125 250 500 1000 2000];
refSurf = 10;
elseif sArgs.bandsperoctave == 3
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;
else
error([upper(mfilename) ':wrong input for bandsperoctave']);
end
elseif strcmpi(sArgs.type,'astm') % Reference curve and frequencies according to ASTM E413
outputStr = 'STC';
roundingFactor = 1;
deficiencyLimit = 8;
sArgs.bandsperoctave = 3;
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];
refSurf = 32;
else
freq = [100,125,160,200,250,315,400,500,630,800,1000,1250,1600,2000,2500,3150]; % Frequencies according to ISO 717-1
refCurve = [33 36 39 42 45 48 51 52 53 54 55 56 56 56 56 56]; % Reference curve according to ISO 717-1
lFreq = length(refCurve);
error([upper(mfilename) ':wrong input for type']);
end
freq = freq(:);
refCurve = refCurve(:);
dbStep = 1;
%% prepare data
msgExtrap = 'Sound insulation data will be extrapolated';
if isa(data,'itaSuper')
freqVector = data.freqVector;
soundInsulation = 20.*log10(interp1(freqVector,data.freqData(:,1),freq,'spline','extrap'));
else
if ~isa(data,'itaSuper')
freqVector = sArgs.freqVector;
if ~isempty(freqVector)
soundInsulation = interp1(freqVector,data,freq,'spline','extrap'); % not in dB?!?
data = itaResult(10.^(data(:)./20),freqVector(:),'freq');
else
error([upper(mfilename) ':not enough input data']);
end
end
freqVector = data.freqVector;
soundInsulation = 20.*log10(interp1(freqVector,data.freqData(:,1),freq,'spline','extrap'));
if isempty(find(freqVector <= freq(1),1,'first')) || isempty(find(freqVector >= freq(end),1,'first'))
warning(upper(mfilename),msgExtrap);
if min(freqVector) > freq(1) || max(freqVector) < freq(end)
warning([upper(mfilename) ': Sound insulation data will be extrapolated']);
end
%% sound insulation index
soundInsulation = round(soundInsulation*10)/10;
delta = refCurve-soundInsulation;
soundInsulationIndexTest = sum(delta(delta>0));
soundInsulation = round(soundInsulation/roundingFactor)*roundingFactor;
soundInsulationIndex = min(floor(soundInsulation-refCurve));
delta = max(0,refCurve + soundInsulationIndex - soundInsulation);
counter = 0; % stopping criterion
% shift reference curve until 32dB is reached
% shift reference curve until limits are reached
Diff = 0;
while abs(soundInsulationIndexTest -refSurf)>1 && counter < 1e6
if counter == 0 % Anpassung der refTerzkurve
Diff = round(mean(delta)*10)/10;
elseif sum(soundInsulationIndexTest) < refSurf-1
Diff = Diff+0.1;
while sum(delta) < refSurf && counter < 1e3
if max(delta) >= deficiencyLimit
break;
elseif sum(delta) < refSurf-1
soundInsulationIndex = soundInsulationIndex + dbStep;
else
Diff = Diff-0.1;
soundInsulationIndex = soundInsulationIndex - dbStep;
end
delta = (refCurve+Diff)- soundInsulation;
soundInsulationIndexTest = sum(delta(delta>0));
delta = max(0,refCurve + soundInsulationIndex - soundInsulation);
counter = counter+1;
end
soundInsulationIndex = round((refCurve(freq == refFreq)+Diff)*100)/100;
deficiencies = itaResult(delta,freq,'freq')*itaValue(1,'dB');
deficiencies.allowDBPlot = false;
%% output
if sArgs.createPlot
plotResult = itaResult;
plotResult.freqVector = freq;
plotResult.freqData(:,1) = 10.^((refCurve+Diff)./20);
plotResult.freqData(:,3) = 10.^(soundInsulation./20);
plotResult.freqData(:,2) = ones(lFreq,1)*10.^(soundInsulationIndex./20);
plotResult.channelNames{3} = 'sound insulation';
plotResult.channelNames{1} = 'shifted reference curve';
plotResult.channelNames{2} = ['R_W = ' num2str(soundInsulationIndex) 'dB'];
plotResult.plot_freq;
xlim([min(freq) max(freq)]);
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');
ita_plot_freq(plotResult,'figure_handle',fgh,'axes_handle',gca,'hold');
bar(gca,deficiencies.freqVector,deficiencies.freq,'hist');
legend({'Sound transmission loss','Shifted reference curve',[outputStr ' = ' num2str(soundInsulationIndex) 'dB'],'Deficiencies'});
ylim([0 max(max(soundInsulation),max(refCurve)+soundInsulationIndex)+15]);
end
varargout{1} = soundInsulationIndex;
% reference curve specified at the freqVector specified by the input itaResult:
if nargout == 2
varargout{2} = interp1(freq, 10.^((refCurve+Diff)./20), freqVector, 'linear');
if nargout >= 2
varargout{2} = interp1(freq, 10.^((refCurve+soundInsulationIndex)./20), freqVector, 'linear');
if nargout == 3
varargout{3} = deficiencies;
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