Ok, I made some progress:
function [result] = roomplot(x, y, z, pos, Lw)
%% Plots sounds pressure distribution
% x, y, z = room dimensions (m)
% pos = position of speaker [X,Y,Z]
% Room : x = 7, y = 4, z = 4 m
% Point: X = 4, y = 2, z = 9 m
% LW : 85dB
%
% Lp = Lw - 20lg * r / m - 8dB; % Moeser, p.76 (3.3)
% resolution
res = 100;
scal = 1/res;
% scale
xv = 0:scal:x;
yv = 0:scal:y;
zv = 0:scal:z;
pos = pos * res;
% room values
V = x * y * z;
A = 2*x*y + 2*x*z + 2*y*z;
% extract position
X = pos(1);
Y = pos(2);
Z = pos(3);
% calculate distance from point
for n = 1:length(xv)
for m = 1:length(yv)
r(m,n) = sqrt((X-n)^2 + (Y-m)^2);
end
end
% logarythmize
z = Lw - 20 .* log10(r) - 8;
% Direct -> Diffuse
% Hallradius https://en.wikipedia.org/wiki/Critical_distance
rH = sqrt( A / 50 );
rHe = find(z > rH); % How to search the "area" for these values??
rHl = find(z < rH); % How to search the "area" for these values??
% build grid
[x,y] = meshgrid(0:scal:x, 0:scal:y);
%% PLOT
surf(x,y,z); shading interp;
set(gca,'cameraposition',[0 0 180]);
colormap(jet(res)); colorbar;
title('Sound Pressure in Room');
end
Any ideas on how I can search for the threshold of the critical distance on the x-y-plane?