Hello everyone
how to generate a circle source in 3D Kgrid? i only see makeCircle(Nx, Ny, cx, cy, radius).what's more, how to generate more three source,such as cylinder?
Thanks in advance!
k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
how to generate a circle in 3D Space
(5 posts) (2 voices)-
Posted 6 years ago #
-
Hello zhangguangjie,
For the cylinder, you can, for instance, just iterate makeCircle with a loop.
I mean :
for i=(1:Nz)
my_cylinder(:,:,i) = makeCircle(..........);
end
(if the cylinder axis is one of the 3 main axis and, if it's not the case, you can just rotate the result after)
For more complex structures, I'm sure that you can find a toolbox doing that. Did you search such a thing in the AddonExplorer?Best regards,
Alexandre
Posted 6 years ago # -
hello Alexandre,
Thank you very much. by your help,I can get a cylinder source model. Now i meet a new problem.
The code are as follows:
Nx = 256;
Ny = 256;
Nz = 256;
dx = 20e-6;
dy = 20e-6;
dz = 20e-6;
kgrid = kWaveGrid(Nx, dx, Ny, dy, Nz, dz);
medium.sound_speed = 1500;
input_args = {'DataCast', 'single'};
magnitude=20;
for i=(127:130)
my_cylinder(:,:,i) =magnitude* makeDisc(Nx, Ny, Nx/2, Ny/2, 20);
end
voxelPlot(my_cylinder)
p0=my_cylinder;
source.p0 = p0;
sensor.mask = zeros(Nx, Ny, Nz);
sensor.mask( Nx/2, Ny/2, 200) = 1;
sensor_data_3D= kspaceFirstOrder3D(kgrid, medium, source, sensor,input_args{:});
when I run the code,
erroe use kspaceFirstOrder_inputChecking (line 749)
source.p0 must be the same size as the computational grid.I can not find the reason for it.
Thanks in advancePosted 6 years ago # -
hello Alexandre
I have solved the problem.
thanks very much!Posted 6 years ago # -
Yes, it was just because you didn't initialize your cylinder as my_cylinder = zeros(Nx,Ny,Nz). No problem,
Best regards,Alex
Posted 6 years ago #
Reply
You must log in to post.