Hi Brad
My codes are as following:
clear all
close all
clc
data_cast = 'single';
run_simulation = true;
pml_x_size = 20; % [grid points]
pml_y_size = 20; % [grid points]
% set total number of grid points not including the PML
sc = 1;
Nx = 256/sc - 2*pml_x_size; % [grid points]
Ny = 256/sc - 2*pml_y_size; % [grid points]
% set desired grid size in the x-direction not including the PML
x = 50e-3; % [m]
% calculate the spacing between the grid points
dx = x/Nx; % [m]
dy = dx; % [m]
kgrid = makeGrid(Nx, dx, Ny, dy);
% define the properties of the propagation medium
medium.sound_speed= 1540; % [m/s]
medium.density = 1000; % [kg/m^3]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
medium.BonA = 6;
% create time array
t_end = (Nx*dx)*2.2/medium.sound_speed; % [s]
[kgrid.t_array, dt]= makeTime(kgrid, medium.sound_speed, [], t_end);
point_magnitude =100*randn(Nx,Ny); % [Pa]
x_pos = 3*Nx/4; % [grid points]
y_pos = Ny/2; % [grid points]
radius = 1; % [grid points]
arc_angle = 2*pi; % [radians]
Disc = point_magnitude.*makeDisc(Nx, Ny, x_pos, y_pos, radius, arc_angle);
imagesc(double(Disc));
%colormap(gray)
density_map = 1000*ones(Nx, Ny);
medium.density = density_map (:,:);
medium.density = medium.density + Disc;
imagesc(double(medium.density));
colormap(gray)
sound_speed_map = 1540*ones(Nx, Ny);
medium.sound_speed = sound_speed_map (:,:);
%medium.sound_speed = medium.sound_speed + Disc;
imagesc(double(medium.sound_speed));
colormap(gray)
number_elements=64;
element_width=1;
element_spacing=0;
transducer_width = number_elements*element_width ...
+ (number_elements - 1)*element_spacing;
sensor.mask = zeros(Nx, Ny);
sensor.mask(1, Ny/2-(number_elements/2-1):Ny/2+number_elements/2) = 1;
%sensor.record_start_index=800;
imagesc(double(sensor.mask));
sensor_element_width=1;
%%================================================
%--synthetic aperture simulation------------------
%=================================================
%matlabpool('open',4); % start of Parallel Computing
j=1;
for i=Ny/2-(number_elements/2-1):Ny/2+number_elements/2;
j
source.p_mask = zeros(Nx, Ny);
source.p_mask(1, i) = 1;
imagesc(source.p_mask);
colormap(gray);
tone_burst_cycles = 1;
tone_burst_freq=3e6;
% % create the input signal using toneBurst
input_signal = toneBurst(1/dt, tone_burst_freq, tone_burst_cycles);%,'Plot', true);
source_strength=1e6;
source.p =(source_strength./(1000*1540)).*input_signal;
source.p_mode='dirichlet';
input_args = {...
'PMLInside', false, 'PMLSize', [pml_x_size, pml_y_size], ...
'DataCast', data_cast, 'DataRecast', true, 'PlotSim', false};
sensor_data{j,1} = kspaceFirstOrder2D(kgrid, medium, source, sensor,input_args{:});
j=j+1;
end
thank you in advanced for your help
Sepand