Helloï¼Œ
Thank you for your toolbox.And I'm a student in high school.I'm confusing how to generate a cylinfrical in 3D Kgrid? Itry to refer the planar transducer but failed.Can you help me.
Thanks in advance!
kWave
A MATLAB toolbox for the timedomain
simulation of acoustic wave fields
how to generate a cylindrical transducer in 3D Space
(4 posts) (2 voices)
Posted 6 months ago #

Hi,
I am using kWave since a few years, so there might be quicker ways to do it now, but you can define transducers of arbitrary shape by making a binary mask.
See the example entitled "Simulating Transducer Field Patterns Example".
A simple way of making a cylinder is, for example, to use makeArc and then extrude the arc:
clearvars close all clc % Transducers parameters R = 11; % curvature radius (unit: grid points) L = 21; % cylinder length (unit: grid points) diameter = 15; % aperture diameter (length of line connecting arc endpoints) (unit: grid points) % Binary mask initialisation Nx = 25; % my example only works properly if it is odd Ny = 25; % my example only works properly if it is odd Nz = 35; %% Arc in 2D arcMask = makeArc([Nx, Nz], [ceil(Nx/2) 2], R, diameter, [ceil(Nx/2) Nz]); figure(1) clf imagesc(arcMask); axis image %% Axis permutation (I assume a main propagation axis along Z and a main cylinder axis along Y) arcMask = reshape(arcMask,[Nx,1,Nz]); source.p_mask = repmat(arcMask,[1 Ny 1]); % extrusion source.p_mask(:,1:(NyL)/2,:) = 0; % crop the left border source.p_mask(:,Ny(NyL)/2+1:Ny,:) = 0; % crop the right border %% 3D display voxelPlot(source.p_mask); % just for fun
Posted 6 months ago # 
PS : By the way I made the code easy to read but, of course, the use of bsxfun() is much more elegant than repmat() ;)
%% Axis permutation (I assume a main propagation axis along Z and a main cylinder axis along Y) arcMask = reshape(arcMask,[Nx,1,Nz]); extrusionVector = [zeros(1,(NyL)/2),ones(1,L),zeros(1,(NyL)/2)]; source.p_mask = bsxfun(@times,arcMask,extrusionVector);
Posted 6 months ago # 
oh,thank you very much!For some reason I didn't see your reply until now.I have solved the problem.But thank you all the same.Your suggestion has given me a lot of inspiration,thank you a lot~
Posted 6 months ago #
Reply
You must log in to post.