k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
- Getting Started
- Examples
- Initial Value Problems
- Example: Homogenous Propagation Medium
- Example: Using A Binary Sensor Mask
- Example: Defining A Sensor Mask By Opposing Corners
- Example: Loading External Image Maps
- Example: Heterogeneous Propagation Medium
- Example: Saving Movie Files
- Example: Recording The Particle Velocity
- Example: Defining A Gaussian Sensor Frequency Response
- Example: Comparison Of Modelling Functions
- Example: Setting An Initial Pressure Gradient
- Example: Simulations In One Dimension
- Example: Simulations In Three Dimensions
- Example: Photoacoustic Waveforms in 1D, 2D and 3D
- Time Varying Source Problems
- Example: Monopole Point Source In A Homogeneous Propagation Medium
- Example: Dipole Point Source In A Homogeneous Propagation Medium
- Example: Simulating Transducer Field Patterns
- Example: Steering A Linear Array
- Example: Snell's Law And Critical Angle Reflection
- Example: The Doppler Effect
- Example: Diffraction Through A Slit
- Example: Simulations In Three-Dimensions
- Sensor Directivity
- Example: Focussed Detector in 2D
- Example: Focussed Detector in 3D
- Example: Modelling Sensor Directivity in 2D
- Example: Modelling Sensor Directivity in 3D
- Example: Sensor Element Directivity in 2D
- Example: Focussed 2D Array with Directional Elements
- Photoacoustic Image Reconstruction
- Example: 2D FFT Reconstruction For A Line Sensor
- Example: 3D FFT Reconstruction For A Planar Sensor
- Example: 2D Time Reversal For A Line Sensor
- Example: 2D Time Reversal For A Circular Sensor
- Example: 3D Time Reversal For A Planar Sensor
- Example: 3D Time Reversal For A Spherical Sensor
- Example: Image Reconstruction With Directional Sensors
- Example: Image Reconstruction With Bandlimited Sensors
- Example: Iterative Image Improvement Using Time Reversal
- Example: Attenuation Compensation Using Time Reversal
- Example: Attenuation Compensation Using Time Variant Filtering
- Example: Automatic Sound Speed Selection
- Diagnostic Ultrasound Simulation
- Example: Defining An Ultrasound Transducer
- Example: Simulating Ultrasound Beam Patterns
- Example: Using An Ultrasound Transducer As A Sensor
- Example: Simulating B-mode Ultrasound Images
- Example: Simulating B-mode Images Using A Phased Array
- Numerical Analysis
- Example: Controlling The Absorbing Boundary Layer
- Example: Source Smoothing
- Example: Filtering A Delta Function Input Signal
- Example: Modelling Power Law Absorption
- Example: Modelling Nonlinear Wave Propagation
- Example: Optimising k-Wave Performance
- Using The C++ Code
- Elastic Wave Propagation
- Example: Explosive Source In A Layered Medium
- Example: Plane Wave Absorption
- Example: Shear Waves And Critical Angle Reflection
- Example: Simulations In Three Dimensions
- Functions - By Category
- Functions - Alphabetical List
- Release Notes
- License
k-Wave Toolbox |
Sensor Element Directivity in 2D Example
On this page… |
---|
Defining directional detectors |
Overview
This example shows how to attribute a directional response to a single-element sensor, or to individual elements of a multi-element sensor array. Directionality can be included without a separate function through explicit averaging, as shown in the examples Modelling Sensor Directivity in 2D and Focussed Detector in 2D, but the functionality described here allows greater flexibility. Note, that directivity defined in this way is currently only supported in 2D. This example builds on the Homogeneous Propagation Medium and Using A Binary Sensor Mask examples.
Defining directional detectors
When using a binary sensor mask, the directionality of each sensor element (defined by the 1's within sensor.mask
) can be set by assigning a directivity angle to the corresponding elements within an Nx
by Ny
matrix assigned to sensor.directivity_angle
. This angle defines the direction of greatest sensitivity for each element. For waves incident from other angles, the sensitivity will be reduced. In this example, a line of spaced sensor points is assigned to a binary sensor mask with each given a different directionality. A directivity angle of 0 (or pi) results in the element being most sensitive to waves travelling in the x (up/down) direction. A directivity of pi/2 (or -pi/2) results in the element being most sensitive to waves travelling in the y (left/right) direction. Figure-of-eight (cos(theta)) directionality can be selected by setting sensor.directivity_pattern = 'gradient'
. With this setting, waves incident at right angles to the sensor element will not be detected. Alternatively, the directionality can be chosen to be equivalent to spatial averaging by setting sensor.directivity_pattern = 'pressure'
. In this case it is also necessary to set the sensor element size using sensor.directivity_size
. For a plane wave incident on a parallel linear detector, this value is equivalent to the size of sensor that each element averages across. If this field is not set, it defaults to 10*kgrid.dx
(i.e., 10 times the width of the spacing between grid points).
% define a line of sensor points sensor.mask = zeros(Nx,Ny); sensor.mask(24,2:2:63) = 1; % define the angle of max directivity for each sensor point: % 0 = max sensitivity in x direction (up/down) % pi/2 or -pi/2 = max sensitivity in y direction (left/right) sensor.directivity_angle = zeros(Nx,Ny); sensor.directivity_angle(24,2:2:63) = (-1:1/15:1)*pi/2; % define the directivity pattern sensor.directivity_pattern = 'pressure'; % define the directivity size sensor.directivity_size = 16*kgrid.dx;
A visualisation of the sensor mask showing the directivity of each element is shown below, superimposed over an image of the source. Note that having many different directivity angles in a single simulation can increase the computation time. However, arrays in which all the elements have the same directionality will run almost as fast as the default omni-directional case.
Running the simulation (initial value problem)
The initial pressure distribution is set up in the usual way and the computation is invoked by calling kspaceFirstOrder2D
with the inputs defined above. To ensure the plane wave source is not distorted by the perfectly matched layer, the part of the PML perpendicular to the propagation direction is turned off by setting the optional input 'PMLAlpha'
to [2 0]
(see Controlling The Absorbing Boundary Layer).
% define the initial pressure distribution source.p0 = zeros(Nx,Ny); source.p0(39:41, :) = 2; % run the simulation sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, 'PMLAlpha', [2 0]);
The maxima of the time series recorded by each sensor element are plotted below. It is clear that the elements with their directivity aligned to the plane wave exhibit greater sensitivity.
Running the simulation (time-varying source)
It is interesting to run this example with a single frequency source, rather than the broadband source produced by the initial pressure distribution. A single frequency time-varying source plane wave source can defined as:
% define a time varying sinusoidal source instead of an initial pressure source.p_mask = source.p0; source.p0 = []; source_freq = 12e6; source_mag = 0.25; source.p = source_mag*sin(2*pi*source_freq*kgrid.t_array);The computation is invoked by calling
kspaceFirstOrder2D
with the inputs defined above. As above, to ensure the source remains as a plane wave, is is necessary to turn off the PML along the sides perpendicular to the wavefront by setting the optional input 'PMLAlpha'
to [2 0]
(see Controlling The Absorbing Boundary Layer).
% run the simulation sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor, 'PMLAlpha', [2 0]);
The maxima of the time series recorded by each sensor element are plotted below on Cartesian and polar plots. Because this example used a single frequency, the characteristic side lobes associated with spatial averaging detectors can be seen.
Modelling Sensor Directivity in 3D | Focussed 2D Array with Directional Elements |
© 2009-2014 Bradley Treeby and Ben Cox.