Hi,
I am trying to set up two transducers with two different frequencies. The code runs, but the problem is I am not able to set independent frequencies for each transducer. For instance, if I want freq1 for the first transducer and freq2 for the second transducer, it runs both transducers at freq1+freq2! Could you please help me figure out where I am making a mistake?
Thanks!!
'% =========================================================================
% SIMULATION
% =========================================================================
n = 2; % use this parameter to modulate the number
% of grid points.
% create the computational grid
Nx = n * 216; % number of grid points in the x (row) direction
Ny = n * 216; % number of grid points in the y (column) direction
dx = 160e-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 * ones(Nx, Ny); % [m/s]
medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]
medium.alpha_power = 1.5;
medium.density = 1000 * ones(Nx, Ny); %[kg/m^3]
% create the time array
kgrid.makeTime(medium.sound_speed);
% define the first curved transducer element
arc_pos_1 = [Nx/2 - 1, 1]; % [grid points]
radius_1 = n * 108; % [grid points]
diameter_1 = n * 81 + 1; % [grid points]
focus_pos_1 = [Nx/2, Ny/2]; % [grid points]
source_1.p_mask = makeArc([Nx, Ny], arc_pos_1, radius_1, diameter_1, focus_pos_1);
source_freq_1 = 1.0e6; % [Hz]
source_mag_1 = 0.5; % [Pa]
source_1.p = source_mag_1 * sin(2 * pi * source_freq_1 * kgrid.t_array);
% filter the source to remove high frequencies not supported by the grid
source_1.p = filterTimeSeries(kgrid, medium, source_1.p);
% define the second curved transducer element
arc_pos_2 = [1, Ny/2]; % [grid points]
radius_2 = n * 108; % [grid points]
diameter_2 = n * 81 + 1; % [grid points]
focus_pos_2 = [Nx/2, Ny/2]; % [grid points]
source_2.p_mask = makeArc([Nx, Ny], arc_pos_2, radius_2, diameter_2, focus_pos_2);
source_freq_2 = 0.5e6; % [Hz]
source_mag_2 = 0.50; % [Pa]
source_2.p = source_mag_2 * sin(2 * pi * source_freq_2 * kgrid.t_array);
% filter the source to remove high frequencies not supported by the grid
source_2.p = filterTimeSeries(kgrid, medium, source_2.p);
% combine the two sources
source.p = source_1.p + source_2.p;
% filter the final source
source.p = filterTimeSeries(kgrid, medium, source.p);
% create a display mask to display the transducer
source.p_mask = source_1.p_mask + source_2.p_mask;
% create a sensor mask covering the entire computational domain using the
% opposing corners of a rectangle
sensor.mask = [1, 1, Nx, Ny].';
% set the record mode capture the final wave-field and the statistics at
% each sensor point
sensor.record = {'p', 'p_max', 'u'};
% assign the input options
input_args = {'DisplayMask', source.p_mask, 'PMLInside', false, 'PlotPML', false};
% run the simulation
sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, input_args{:});'