k-Wave Toolbox |
![]() ![]() |
On this page… |
---|
This example provides a demonstration of using k-Wave for the simulation and detection of photoacoustic waves within a two-dimensional heterogeneous propagation medium. It builds on the Homogeneous Propagation Medium Example.
For a homogeneous propagation medium, the sound speed and density are given as scalar values in SI units. If the propagation medium is heterogeneous, medium.sound_speed
and medium.density
are instead given as matrices with the same size and dimensions as the initial pressure distribution. These matrices can be created in several fashions, including explicity (as given below; note the ordering of the inputs), from external images maps, or using spatial or volume data from other simulations or experimental imaging modalities.
% define the properties of the propagation medium medium.sound_speed = 1500*ones(Nz, Nx); % [m/s] medium.sound_speed(1:Nz/2, :) = 1800; % [m/s] medium.density = 1000*ones(Nz, Nx); % [kg/m^3] medium.density(:, Nx/4:end) = 1200; % [kg/m^3]
The computation is again invoked by running kspaceFirstOrder2D
with the inputs defined above. Rather than explicity producing a plot of the initial pressure distribution, sensor mask, and medium properties, it is easier to use the inbuilt functionality of kspaceFirstOrder2D
by setting the optional input 'PlotLayout'
to true
(optional inputs for k-Wave functions are given as 'string'
, value
pairs). This produces a plot of the simulation inputs as shown below.
% run the simulation setting the display flag to true sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, 'PlotLayout', true);
A plot of the recorded time series is given below. The shape of the main wave-front has been perturbed compared to the homogeneous example, and weak reflections from the heterogeneous interfaces can also be seen.
![]() |
Loading External Image Maps | Saving Movie Files | ![]() |
© 2009, 2010 Bradley Treeby and Ben Cox.