Hey there,
i'm working on a little sound simulation for loudspeakers.
With a point source, shouldn't the sound pressure level decrease linear with increasing distance from the source (p ~ 1 / r)?
I've attached an little example:
Sensor 1 is in 30*dx distance from source
Sensor 2 in in 60*dx distance from source
The results are:
max Pressure Sensor 1: 0.1751 Pa
max Pressure Sensor 2: 0.12383 Pa
but they dont match with p2 = p1*(r1/r2) = 0.1751*(30/60) = 0,0876 Pa
Can someone help me?
Best regards
Andreas
EXAMPLE:
% Monopole Point Source In A Homogeneous Propagation Medium Example
%
% This example provides a simple demonstration of using k-Wave for the
% simulation and detection of a time varying pressure source within a
% two-dimensional homogeneous propagation medium. It builds on the
% Homogeneous Propagation Medium and Recording The Particle Velocity
% examples.
%
% author: Bradley Treeby
% date: 2nd December 2009
% last update: 4th May 2017
%
% This function is part of the k-Wave Toolbox (http://www.k-wave.org)
% Copyright (C) 2009-2017 Bradley Treeby
% This file is part of k-Wave. k-Wave is free software: you can
% redistribute it and/or modify it under the terms of the GNU Lesser
% General Public License as published by the Free Software Foundation,
% either version 3 of the License, or (at your option) any later version.
%
% k-Wave is distributed in the hope that it will be useful, but WITHOUT ANY
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
% FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
% more details.
%
% You should have received a copy of the GNU Lesser General Public License
% along with k-Wave. If not, see <http://www.gnu.org/licenses/>.
clearvars;
% =========================================================================
% SIMULATION
% =========================================================================
% create the computational grid
Nx = 128; % number of grid points in the x (row) direction
Ny = 128; % number of grid points in the y (column) direction
dx = 50e-3/Nx; % grid point spacing in the x direction [m]
dy = dx; % grid point spacing in the y direction [m]
kgrid = kWaveGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium
medium.sound_speed = 343; % [m/s]
medium.alpha_coeff = 0;%0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 0;%1.5;
% create the time array
kgrid.makeTime(medium.sound_speed);
% define a single source point
source.p_mask = zeros(Nx, Ny);
source.p_mask(end - Nx/4, Ny/2) = 1;
xpos_source = Nx- Nx/4;
% define a time varying sinusoidal source
source_freq = 0.25e6; % [Hz]
source_mag = 2; % [Pa]
source.p = source_mag * sin(2 * pi * source_freq * kgrid.t_array);
source.p_mode = 'dirichlet';
% filter the source to remove high frequencies not supported by the grid
source.p = filterTimeSeries(kgrid, medium, source.p);
% define a single sensor point
sensor.mask = zeros(Nx, Ny);
xpos_sensor_1 = xpos_source - 30;
xpos_sensor_2 = xpos_source - 60;
sensor.mask(xpos_sensor_1, Ny/2) = 1;
sensor.mask(xpos_sensor_2, Ny/2) = 1;
% define the acoustic parameters to record
sensor.record = {'p', 'p_final'};
%% run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);
%%
% =========================================================================
% VISUALISATION
% =========================================================================
% plot the final wave-field
figure;
imagesc(kgrid.y_vec * 1e3, kgrid.x_vec * 1e3, ...
sensor_data.p_final + source.p_mask + sensor.mask, [-1, 1]);
colormap(getColorMap);
ylabel('x-position [mm]');
xlabel('y-position [mm]');
axis image;
% plot the simulated sensor data
figure;
[t_sc, scale, prefix] = scaleSI(max(kgrid.t_array(:)));
subplot(2, 1, 1);
plot(kgrid.t_array * scale, source.p, 'k-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Input Pressure Signal');
subplot(2, 1, 2);
plot(kgrid.t_array * scale, sensor_data.p, 'r-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Sensor Pressure Signal');
disp(['max Pressure Sensor 1: ', num2str(max(sensor_data.p(2,:)))]);
disp(['max Pressure Sensor 2: ', num2str(max(sensor_data.p(1,:)))]);