Dear all,
I just checked out the new kWaveArray class to model sensor surfaces without artifacts (new in version 1.4).
I intended to a cylindrical surface to a 3D simulation. As this does not match any of the predefined transducer shapes, I wanted to add a custom shape. However, when I try to add the surface as CustomElement, I cannot set the dimension to 2, because I pass 3D surface positions. In the implementation of kWaveArray, I can see that for bowls the dimension is still set to 2 and then a custom method to create the surface accordingly is called to return the grid points. Is there any possibility to define such a transducer surface as kWaveArray in 3D or without major changes in the kWaveArray class?
Thanks a lot for any help!
Code
%% Define Transducer params
width_half_elem = 5e-4;
arclength_elem_half = 2e-3;
radius_single_elem = 1e-2;
res_min = 100e-6;
upsampling_factor = 2;
%% Discretize the transducer
size_integration_area = arclength_elem_half * width_elem_half * 4;
angle_step_max = asin(res_min/upsampling_factor/radius_single_elem);
num_angle_steps_half = round((arclength_elem_half/radius_single_elem/angle_step_max));
num_width_steps_half = round(width_half_elem/(res_min/upsampling_factor));
[width_surface_discr_transd,angles_surface_discr_transd] = ...
meshgrid((-num_width_steps_half:num_width_steps_half)*(res_min/upsampling_factor),...
(-num_angle_steps_half:num_angle_steps_half)*angle_step_max);
num_discr_points = numel(width_surface_discr_transd);
width_surface_discr_transd = reshape(width_surface_discr_transd,[1 num_discr_points]);
angles_surface_discr_transd = reshape(angles_surface_discr_transd,[1 num_discr_points]);
array_elems = [width_surface_discr_transd;
radius_single_elem *sin(angles_surface_discr_transd);
radius_single_elem *(1-cos(angles_surface_discr_transd))];
karray.addCustomElement(array_elems, size_integration_area, 2, 'Custom_Transducer_Cyl');
Resulting error message:
Error using addCustomElement
Expected input number 1, integration_points, to be two-dimensional.
Error in kWaveArray/addCustomElement (line 608)
validateattributes(integration_points, {'numeric'}, {'finite', 'real', '2d'}, 'addCustomElement', 'integration_points',1);