Hello, professor Treeby. I tried to adding two concave sphere elements Using kWaveArray.addBowlElement. The specific implementation process is as follows:
% --------------------
% SOURCE
% --------------------
% create time varying source
source_sig = createCWSignals(kgrid.t_array, source_f0, source_amp, 0);
% set bowl 1 position and orientation
bowl_pos = [kgrid.x_vec(1), 0, 0];
focus_pos = [kgrid.x_vec(end), 0, 0];
% create empty kWaveArray
karray = kWaveArray('BLITolerance', bli_tolerance, 'UpsamplingRate', upsampling_rate, 'SinglePrecision', true);
% add bowl 1 shaped element
karray.addBowlElement(bowl_pos, source_roc, source_diameter, focus_pos);
% set bowl 2 position and orientation
bowl_pos = [kgrid.x_vec(end), 0, 0];
focus_pos = [kgrid.x_vec(1), 0, 0];
% add bowl 2 shaped element
karray.addBowlElement(bowl_pos, source_roc, source_diameter, focus_pos);
% assign binary mask
source.p_mask = karray.getArrayBinaryMask(kgrid);
% assign source signals
source.p = karray.getDistributedSourceSignal(kgrid, source_sig);
Although the addition was successful, an error occurred when using karray.getDistributedSourceSignal assign source signals. The error is following as:
Example_CustomedPhaseArray
Computing distributed source signal...
calculating binary mask... completed in 52.835s
approximate size of source matrix: 790 MB (single precision)
calculating element 1 grid weights... completed in 21.28s
calculating element 1 distributed source... completed in 0.691s
calculating element 2 grid weights... completed in 46.656s
calculating element 2 distributed source... The index at position 1 exceeds the array boundary. The index cannot exceed 1.
Error kWaveArray/getDistributedSourceSignal (Line 1057)
+ bsxfun(@times, source_weights(element_mask_ind), source_signal(ind, :));
Error Example_CustomedPhaseArray (Line 92)
source.p = karray.getDistributedSourceSignal(kgrid, source_sig);
I tried to find the causefrom kwavearray, but failed! Thus, I would like to consult with the professor!
Thank you for the attention.
Jiupeng Xiong