Hi Ben
The source code of the program is given below:
clear all;
close all;
clc;
% =========================================================================
% SIMULATION
% =========================================================================
% create the computational grid
Nx = 600; % number of grid points in the x (row) direction
Ny = 600; % number of grid points in the y (column) direction
dx = 6.52e-5; % grid point spacing in the x direction [m]
dy = 6.52e-5; % grid point spacing in the y direction [m]
kgrid = makeGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium (Mucosa and Submucosa)
medium.sound_speed = 1500*ones(Nx, Ny); % [m/s]
medium.sound_speed(300:315,:) = 1500; % [m/s]
medium.density = 1000*ones(Nx, Ny); % [kg/m^3]
medium.density(300:315,:) = 1200; % [kg/m^3]
%medium.alpha_power = 1.5;
%medium.alpha_coeff = 1.8; % [dB/(MHz^y cm)]
% define the properties of the propagation medium (Muscle)
medium.sound_speed(316:329,:) = 1580; % [m/s]
medium.density(316:329,:) = 1000; % [kg/m^3]
% define the properties of the propagation medium (Fat)
medium.sound_speed(330:335,:) = 1450; % [m/s]
medium.density(330:335,:) = 910; % [kg/m^3]
% define the properties of the propagation medium (Water)
medium.sound_speed(336:end,:) = 1482; % [m/s]
medium.density(336:end,:) = 1000; % [kg/m^3]
% create the time array
[kgrid.t_array, dt] = makeTime(kgrid, medium.sound_speed);
Nt = length(kgrid.t_array);
% define a single source element
source.p_mask = zeros(Nx, Ny);
source.p_mask( Nx/2, Ny/2) = 1;
% define a time varying sinusoidal source
source_freq = 10e6; % [Hz]
source_mag = 15; % [au]
source.p = source_mag*sin(2*pi*source_freq*kgrid.t_array);
% smooth the source
source.p = filterTimeSeries(kgrid, medium, source.p);
% define a centered circular sensor
sensor_x_pos = Nx/2; % [grid points]
sensor_y_pos = Ny/2; % [grid points]
sensor_radius = 290; % [m]
sensor_arc_angle = pi;
sensor.mask = makeCircle(Nx, Ny, sensor_x_pos, sensor_y_pos, sensor_radius, sensor_arc_angle);
% run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, 'PlotLayout', true, 'PMLAlpha', [0 2]);
% =========================================================================
% VISUALISATION
% =========================================================================
% plot the simulated sensor data
figure;
imagesc(sensor_data, [-1, 1]);
colormap(getColorMap);
ylabel('Sensor Position');
xlabel('Time Step');
colorbar;
Thanks,
Eldhose