Hello,
I am using k-Wave to simulate some embeddings within tissue and have been referencing your example, example_us_bmode_phased_array.m. I encountered an issue when adjusting the wave speed and density of the embedding.
When the embedding's wave speed and density are half that of the tissue, the simulation works perfectly. However, when I set the wave speed and density to twice that of the tissue, the sensor data becomes unstable, increasing exponentially and eventually resulting in NaN values. Consequently, the B-mode image is not visible.
I have attached my code defining the properties for your reference. Thank you very much for your software and assistance!
Best wishes
Haohui Zhang
'% define properties
sound_speed_map = c0 * ones(Nx, Ny, Nz) ;
density_map = rho0 * ones(Nx, Ny, Nz) ;
sound_speed_iron = c0*2;
density_iron = rho0*2;
% define a cylinder for Iron oxide
radius = 4e-3;
x_pos = 28e-3;
y_pos = dy * Ny/2;
x_loc = round(x_pos / dx);
height = 4e-3;
x_height = round(height / dx);
neighbor = 12e-3;
scattering_plane1 = makeDisc(Ny, Nz, round(y_pos / dx), Nz/2, round(radius / dx)); % Center array
scattering_plane2 = makeDisc(Ny, Nz, round((y_pos-neighbor)/ dx), Nz/2, round(radius / dx)); % Left array
scattering_plane3 = makeDisc(Ny, Nz, round((y_pos+neighbor)/ dx), Nz/2, round(radius / dx)); % Right array
scattering_plane = scattering_plane1 + scattering_plane2 + scattering_plane3;
scattering_region = repmat(scattering_plane,[1,1,Nx]);
scattering_region = permute(scattering_region,[3,1,2]);
tmp = scattering_region;
tmp([1:x_loc,x_loc+x_height:end],:,:) = 0;
% assign region
sound_speed_map(tmp == 1) = sound_speed_iron;
density_map(tmp == 1) = density_iron;
% assign to the medium inputs
medium.sound_speed = sound_speed_map;
medium.density = density_map;'