Hi Dr. Cox and Dr. Treeby,
My question is about sensor data that is received after moving the target. I read posts regarding delay but didn't get an answer. When I move medium I don't get any shift in the signal that I am supposed to see. Is there some internal mechanism that gets rid of the shift in the signals so that they start at time index 0 ? I urgently need help. I have tried everything after reading the posts and manual but haven't got lucky yet. I also tried the bmode linear transducer example but the received signal for each scan line is not shifted.
Here is my code:
clear all;
pml_x_size = 20;
pml_y_size = 20;
% create the computational grid
Nx = 128 - 2*pml_x_size; % number of grid points in the x (row) direction
Ny = 96 - 2*pml_y_size; % number of grid points in the y (column) direction
dx = 0.2e-3; % grid point spacing in the x direction [m]
dy = 0.2e-3; % grid point spacing in the y direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy);
gridx_pts =11;
c0 = 1540; % [m/s]
rho0 = 1000; % [kg/m^3]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
medium.BonA = 6;
medium.sound_speed_ref = 1540;
% define the properties of the propagation medium
t_end = (Nx*dx)*2.2/c0; % [s]
kgrid.t_array = makeTime(kgrid, c0, [], t_end);
source_strength = 5e6; % [Pa]
tone_burst_freq = 1.875e6; % [Hz]
tone_burst_cycles = 5;
% create the input signal using toneBurst
input_signal = toneBurst(1/kgrid.dt, tone_burst_freq, tone_burst_cycles);
% scale the source magnitude by the source_strength divided by the
% impedance (the source is assigned to the particle velocity)
input_signal = (source_strength./(c0*rho0)).*input_signal;
%
%define the source
source.p_mask = zeros(Nx,Ny);
num_elements = 32; % [grid points]
x_offset = 1; % [grid points]
start_index = Ny/2 - round(num_elements/2) + 1;
source.p_mask(x_offset, start_index:start_index + num_elements - 1) = 1;
source.p = input_signal;
% define the sensor
sensor.mask = zeros(Nx,Ny);
x_offset = 1; % [grid points]
start_index = Ny/2 - round(num_elements/2) + 1;
sensor.mask(x_offset, start_index) = 1;
sensor.mask(x_offset,start_index+13) = 1;
%define medium
Ny_tot = Ny+gridx_pts;
sound_speed_map = c0*ones(Nx, Ny_tot);
density_map = rho0*ones(Nx, Ny_tot);
cwire = 3000;
scattering_rho0 = cwire/1.5;%1150
% define the fishing wire point as a ball (high scattering intensity)
radius = 0.1e-3; % [m]
scattering_region = makeCircle(Nx, Ny_tot, Nx-1,Ny_tot/2,radius,'true');
% assign scatterer the properties
sound_speed_map(scattering_region == 1) = cwire;
density_map(scattering_region == 1) = scattering_rho0;
%%
input_args = {'PMLInside', false, 'PMLSize', [pml_x_size, pml_y_size],'PlotSim',true,'PlotLayout',true,'PlotScale','auto'};
for i = 1:4
medium.sound_speed = sound_speed_map(:,i:i+Ny-1);
medium.density = density_map(:,i:i+Ny-1);
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);
sdata(i,:,:) = sensor_data;
end
%% =========================================================================
% VISUALISATION
% =========================================================================
% plot the simulated sensor data
figure;
hold on;
for i = 1:4
plot(reshape(sdata(i,2,:),[1,kgrid.Nt]))
end
colormap(getColorMap);
ylabel('Sensor Position');
xlabel('Time Step');
colorbar;