cw_pressure()
Description: This function is used to calculate continuous-wave pressures with the Fast Nearfield Method in FOCUS.
Usage
pressure = cw_pressure(transducer, cg, medium, ndiv, f0);
pressure = cw_pressure(transducer, cg, medium, ndiv, f0, method);
Arguments
- transducer A FOCUS transducer array.
- cg A FOCUS coordinate grid.
- medium A FOCUS medium.
- ndiv The number of integral points to use.
- f0 Frequency of the array in Hz.
- method The method to use when calculating the pressure. If the string 'sse' is present, SSE instructions will be used to speed up the calculation where possible - see the documentation for fnm_cw_sse for details. Valid calculation methods are:
- 'fnm' Use the Fast Nearfield Method (fnm_cw) to calculate the pressure - this is the default.
- 'farfield' Use the farfield approximation (farfield_cw) to calculate the pressure.
- 'rayleigh' Use the Rayleigh-Sommerfeld Integral (rayleigh_cw) to calculate the pressure.
Output Parameters
- pressure A 3-d array representing the complex pressure at each point
Notes
Advanced users may wish to use fnm_cw for access to more features and options.
The value of the ndiv parameter should be chosen based on the spatial location of the simulation relative to the transducer and the desired calculation accuracy. The only way to determine the optimal value for this parameter is to perform the calculation with a very large ndiv (e.g. 200) and then compare calculations performed with progressively larger ndiv values to the reference pressure until the desired accuracy is achieved. See the FNMcirc example (in /Examples/Papers) for an example of this type of calculation.
A good approximation for the ndiv value for single transducers can be calculated by the formula n = 2 × d⁄λ, where d is the transducer width and λ is the wavelength.
SSE calculations are about four times as fast as standard calculations, but because they use single precision values rather than double precision, the maximum accuracy is on the order of 10 - 4.

