Hi Brad
Thanks for your reply.
I've reviewed my original code and realised I was re-defining the tx frequency inside another script call! So now my question is regarding the frequency change.
I've added my code below too which includes a dB plot for clarity.
By setting source_freq = 1e6
with t_end=100e-6
and varying Nx & Ny from 128 to 1024, I see a small reverberation occurring after the main peak.
To investigate further, I added a second tone burst and it appears that the reverberation is a smaller amplitude replica of the transmitted signal.
So is this an issue with 2D simulations?
Thanks for your time!
clearvars;
% =========================================================================
% SIMULATION
% =========================================================================
% create the computational grid
Nx = 1024; % number of grid points in the x (row) direction
Ny = 1024; % 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 = 1500; % [m/s]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
% create the time array
kgrid.makeTime(medium.sound_speed);
t_end = 100e-6;
kgrid.makeTime(medium.sound_speed, [], t_end)
% define a single source point
source.p_mask = zeros(Nx, Ny);
source.p_mask(end - Nx/4, Ny/2) = 1;
% define a time varying sinusoidal source
source_freq = 1e6; % [Hz]
source_mag = 2; % [Pa]
source.p = source_mag * sin(2 * pi * source_freq * kgrid.t_array);
source.p = [toneBurst(1/kgrid.dt, source_freq, 8), zeros(1,100),toneBurst(1/kgrid.dt, source_freq, 3)] ;
source.p=[source.p, zeros(1,length(kgrid.t_array)-length(source.p))];
% 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);
sensor.mask(Nx/4, Ny/2) = 1;
% define the acoustic parameters to record
sensor.record = {'p', 'p_final'};
% run the simulation
sensor_data = kspaceFirstOrder2DG(kgrid, medium, source, sensor);
% =========================================================================
% VISUALISATION
% =========================================================================
% plot the simulated sensor data
figure;
[t_sc, scale, prefix] = scaleSI(max(kgrid.t_array(:)));
subplot(2, 1, 1);
plot(kgrid.t_array * scale, 1-20*log(1./(sensor_data.p./max(sensor_data.p))), 'r-');
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');