k-Wave Toolbox |

## Steering A Linear Array Example

On this page…
Overview Defining the linear array and input signal Running the simulation

### Overview

This example demonstrates how to use k-Wave to steer a tone burst from a linear array transducer. It builds on the Simulating Transducer Field Patterns Example.

- open the file in the MATLAB Editor
- run the file in MATLAB

Back to Top

### Defining the linear array and input signal

The source mask is defined by creating a binary mask with the desired elements set to 1.

    % define a linear element transducer with an odd number of elements
    num_elements = 21;
    z_offset = 25;
    source.p_mask = zeros(Nz, Nx);
    start_index = Nz/2 - round(num_elements/2) + 1;
    source.p_mask(z_offset, start_index:start_index + num_elements - 1) = 1;

The input signal to each element is then created using the function `toneBurst` with a geometrically steered temporal offset that varies across the source.

    % define the properties of the tone burst using a geometrically steered
    % transmit pulse offset
    steering_angle = 30;
    element_spacing = dz;
    element_index = -(num_elements - 1)/2:(num_elements - 1)/2;
    tone_burst_offset = 40 + element_spacing*element_index*...
        sin(steering_angle*pi/180)/(medium.sound_speed*dt);
    tone_burst_freq = 1e6;
    tone_burst_cycles = 8;
    tone_burst_signal_length = length(kgrid.t_array);
    sampling_freq = 1/dt;
    source.p = toneBurst(sampling_freq, tone_burst_freq,...
        tone_burst_signal_length, tone_burst_offset, tone_burst_cycles);

A plot of the input signals for each transducer element is shown below.

Back to Top

### Running the simulation

Visualisations of the pressure field at two different times for steering angles of +30 and -20 degrees are shown below.

Back to Top

© 2009, 2010 Bradley Treeby and Ben Cox.