Commit fe4c1c90 authored by Lukas Aspöck's avatar Lukas Aspöck

- equation based reverb time calculation now calculates the factor (~0.16)…

- equation based reverb time calculation now calculates the factor (~0.16) according to environmental parameters
- improved material characteristics plots (markers, output quality of pngs)
parent 2ce56dbc
......@@ -845,12 +845,17 @@ classdef itaRavenProject < handle
currentMaterial.allowDBPlot = false;
ita_plot_freq(currentMaterial,'LineWidth',2);
myAxes = gca;
for iMat=1:numberMaterials
myAxes.Children(iMat+2).Marker = 's';
end
% change format of plot
title('');
ylabel('Absorption coefficient');
xlabel('Frequency in Hz');
set(gca,'XLim',[63 20000]);
set(gca,'YLim',[0 1]);
set(myAxes,'XLim',[20 20000]);
set(myAxes,'YLim',[0 1.05]);
leg = findobj(gcf,'Tag','legend');
set(leg,'Location','NorthWest');
set(leg,'FontSize',12);
......@@ -860,14 +865,15 @@ classdef itaRavenProject < handle
leg.String{iMat} = leg.String{iMat}(1:end-4);
end
% export plot to raven output
if (exportPlot)
[pathstr,name,ext] = fileparts(obj.ravenProjectFile);
dateTimeStr = datestr(now,30);
dateTimeStr = strrep(dateTimeStr,'T','_');
fileName = [ obj.pathResults '\Absorption_' name '_' dateTimeStr '.png'];
saveas(gcf,fileName);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
set(gcf,'PaperUnits','inches','PaperPosition',1.34*[0 0 8 5]);
print('-dpng','-r200', fileName);
end
end
......@@ -902,17 +908,23 @@ classdef itaRavenProject < handle
currentMaterial.channelNames = allMaterials;
currentMaterial.allowDBPlot = false;
currentMaterial.pf;
ita_plot_freq(currentMaterial,'LineWidth',2);
myAxes = gca;
for iMat=1:numberMaterials
myAxes.Children(iMat+2).Marker = 's';
end
% change format of plot
title('');
ylabel('Scattering coefficient');
xlabel('Frequency in Hz');
set(gca,'XLim',[63 20000]);
set(gca,'YLim',[0 1]);
set(myAxes,'XLim',[20 20000]);
set(myAxes,'YLim',[0 1.05]);
leg = findobj(gcf,'Tag','legend');
set(leg,'Location','NorthWest');
set(leg,'FontSize',9);
set(leg,'FontSize',12);
% remove [1] in legend entry
for iMat=1:numberMaterials
......@@ -925,7 +937,9 @@ classdef itaRavenProject < handle
dateTimeStr = datestr(now,30);
dateTimeStr = strrep(dateTimeStr,'T','_');
fileName = [ obj.pathResults '\Scattering_' name '_' dateTimeStr '.png'];
saveas(gcf,fileName);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
set(gcf,'PaperUnits','inches','PaperPosition',1.34*[0 0 8 5]);
print('-dpng','-r200', fileName);
end
end
......@@ -2927,23 +2941,33 @@ classdef itaRavenProject < handle
end
end
% determine factor (default: 0.161) and air absorption
factor = 24*log(10) / calculateSoundSpeed(obj.getTemperature, obj.getHumidity,obj.getPressure);
airAbsorption = determineAirAbsorptionParameter(obj.getTemperature, obj.getPressure, obj.getHumidity);
% get reverberation time
if (eyring == 1)
airAbsorption = determineAirAbsorptionParameter(obj.getTemperature, obj.getPressure, obj.getHumidity);
RT = roommodel.getReverbTime(obj.pathMaterials, 'eyring', airAbsorption);
RT = roommodel.getReverbTime(obj.pathMaterials, 'eyring', factor, airAbsorption);
else
airAbsorption = determineAirAbsorptionParameter(obj.getTemperature, obj.getPressure, obj.getHumidity);
RT = roommodel.getReverbTime(obj.pathMaterials, 'sabine', airAbsorption);
RT = roommodel.getReverbTime(obj.pathMaterials, 'sabine', factor, airAbsorption);
end
end
%------------------------------------------------------------------
function RT = getReverbTime_Sabine(obj)
% getReverbTime_Sabine
% returns the _calculated_ reverberation time based on the
% volume, surface area and the absorption coefficients of the room
% according to Sabine equation
RT = obj.getEquationBasedReverbTime(0);
end
%------------------------------------------------------------------
function RT = getReverbTime_Eyring(obj)
% getReverbTime_Eyring
% returns the _calculated_ reverberation time based on the
% volume, surface area and the absorption coefficients of the room
% according to Eyring equation
RT = obj.getEquationBasedReverbTime(1);
end
......
......@@ -405,10 +405,14 @@ classdef load_ac3d
[A, S] = obj.getEquivalentAbsorptionArea_sabine();
end
function RT = getReverbTime(obj, material_path, sabine_or_eyring, airAbsorption, portal_surface_materials)
if nargin < 3
function RT = getReverbTime(obj, material_path, sabine_or_eyring, factor, airAbsorption, portal_surface_materials)
if nargin < 4
airAbsorption = zeros(1,31);
end
if nargin < 3
factor = 0.161;
end
if nargin < 3
sabine_or_eyring = 'eyring';
end
......@@ -416,7 +420,7 @@ classdef load_ac3d
material_path = '..\RavenDatabase\MaterialDatabase';
end
if nargin > 4
if nargin > 5
if strcmp(sabine_or_eyring, 'eyring')
[A, S] = obj.getEquivalentAbsorptionArea_eyring(material_path, portal_surface_materials);
else
......@@ -438,7 +442,7 @@ classdef load_ac3d
%RT = 0.163 .* obj.totalVolume ./ A;
% RT = (2.76 / sqrt(273.15 + room_temperature)) .* (obj.totalVolume ./ A);
RT = 0.163 .* obj.totalVolume ./ (A + 4*airAbsorption*obj.totalVolume);
RT = 0.161 .* obj.totalVolume ./ (A + 4*airAbsorption*obj.totalVolume);
end
% get surface area of given material
......
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