The added rectangular elements are 1 mm wide, 1 mm long, and 1.2 mm apart. However, after using the voxelPlot function to visualize, the red cubes are all overlapped, and after adjusting the interval to separate them, when the dx is 0.5mm, it is found that there are 20*20 red cubes in each rectangular array in voxelPlot. How can I solve this problem, my code is as follows。 Looking forward to your answer!
element_num_x = 8;
element_num_y = 8;
element_width = 1e-3;
element_length = 1e-3;
element_pitch = 1.2e-3;
rotation = [0, 0, 0];
x_pos = (0:element_pitch:(element_num_x)*element_pitch);
y_pos = (0:element_pitch:(element_num_x)*element_pitch);
karray = kWaveArray();
for ind = 1:element_num_x
for k = 1:element_num_y
karray.addRectElement([x_pos(ind) ,y_pos(k) ,kgrid.z_vec(1)+ z_compensate], element_width, element_length, rotation);
end
end
sensor.mask = karray.getArrayBinaryMask(kgrid);
voxelPlot(sensor.mask, 'Color', [1 0 0], 'Transparency', 0.5);