Hello AVB,
Run the code below. It has a source. A linear sensors array. perform some DOA algorithm like CAPON or Delay-and-sum on the recorded data you will get the direction of source. It has a linear array of there sensors placed at the possition (-0.4667,-99.8667) (0,-99.8667) and ( 0.4667,-99.8667).
clear all;
clc;
close all;
PML_size = 5;
C = 1400;
f_max = 1500;
dx = C/(2*f_max);
dy=dx;
grid_length = 200;
Ny = round(grid_length/dy);
Nx = Ny;
kgrid = makeGrid (Nx,dx,Nx,dy);
co_ordinate = sqrt(kgrid.x.^2 + kgrid.y.^2);
mid_pt = find(kgrid.x==0);
mid_pt = mid_pt(1);
% define the properties of the propagation medium
medium.sound_speed = C; % [m/s]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
% create the time array
cfl = 0.2; %Courant-Friedrichs-Lewy number
f_sig=1000;
FS=10*f_sig;
dt=1/FS;
kgrid.t_array= 0:dt:0.5;
% define a time varying sinusoidal source
A=5; % [Pa]
source.p = A*sin(2*pi*f_sig*kgrid.t_array);
%define a tone burst
%sampling_freq = 1/dt; % [Hz]
%tone_burst_freq = 1.5e3; % [Hz]
%tone_burst_cycles = 3;
%source.p = source_mag*toneBurst(sampling_freq, tone_burst_freq, tone_burst_cycles);
% define a single source point
source.p_mask = zeros(Nx, Ny);
xs=mid_pt;
ys=mid_pt;
source.p_mask(xs, ys) = 1;
%define sensor point
incr=1;% 0.4667m spacing
sensor.mask = zeros(Nx, Ny);
y_sens = 10;
x_sens=(mid_pt-incr):incr:(mid_pt+incr);
sensor.mask(x_sens, y_sens) = 1;
%define the acoustic parameters to record
sensor.record = {'p'};
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, 'PMLInside',true, 'PlotPML', true );
%plot the recorded data
figure;
subplot(4, 1, 1);
[t_sc scale prefix] = scaleSI(max(kgrid.t_array(:)));
plot(source.p, 'b-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Source Pressure Signal');
subplot(4, 1, 2), plot(kgrid.t_array*scale, sensor_data.p(1, :), 'r-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Sensor-1 Pressure Signal');
subplot(4, 1, 3), plot(kgrid.t_array*scale, sensor_data.p(2, :), 'r-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Sensor Pressure Signal');
subplot(4, 1, 4), plot(kgrid.t_array*scale, sensor_data.p(3, :), 'r-');
xlabel(['Time [' prefix 's]']);
ylabel('Signal Amplitude');
axis tight;
title('Sensor Pressure Signal');