# k-Wave

## A MATLAB toolbox for the time-domain

simulation of acoustic wave fields

## Windows

1

Save and unpack the k-Wave zip file to a suitable folder e.g.,

`C:\Program Files\MATLAB\...your matlab version...\toolbox\k-Wave`

2

Add this folder to the MATLAB path. This can be done using the "Set Path" dialog box which is accessed by typing

Alternatively, the toolbox can be installed by adding the line

to the

`pathtool`

at the MATLAB command prompt. This dialog box can also be accessed using the dropdown menus ("File -> Set Path" if using MATLAB 2012a and earlier, or "Set Path" on the ribbon bar if using MATLAB 2012b and later). Once the dialog box is open, the toolbox is installed by clicking "Add Folder", selecting the k-Wave Toolbox folder, and clicking "save" (see Fig. 1). The toolbox can be uninstalled in the same fashion.Alternatively, the toolbox can be installed by adding the line

`addpath('...full pathname used above...\k-Wave');`

to the

`startup.m`

file. If no `startup.m`

file exists, create one and save it in the MATLAB startup directory or any directory in the MATLAB path.
3

Restart MATLAB (or run

`startup`

at the command line to add the path to the current MATLAB session).
4

Open the help browser, and try running some of the examples by first selecting them and then clicking on "run the file". In MATLAB 2012a and earlier, the help browser is opened by clicking on the blue question mark icon on the menu bar, then selecting "k-Wave Toolbox" under the contents tab (see Fig. 2). In MATLAB 2012b and later, the help browser is opened by clicking on the question mark icon above "Help" on the ribbon bar, and then clicking on "Supplemental Software".

## Linux

1

Save and unpack the k-Wave zip file to a suitable folder e.g.,

`~/MATLAB/k-Wave`

2

Add this folder to the MATLAB path. This can be done using the "Set Path" dialog box which is accessed by typing

Alternatively, the toolbox can be installed by adding the line

to the

`pathtool`

at the MATLAB command prompt. This dialog box can also be accessed using the dropdown menus ("File -> Set Path" if using MATLAB 2012a and earlier, or "Set Path" on the ribbon bar if using MATLAB 2012b and later). Once the dialog box is open, the toolbox is installed by clicking "Add Folder", selecting the k-Wave Toolbox folder, and clicking "save" (see Fig. 1). The toolbox can be uninstalled in the same fashion. Note, you will need write access to the pathdef.m file. By default, this is located at `...matlabroot.../toolbox/local`

.Alternatively, the toolbox can be installed by adding the line

`addpath('...full pathname used above...\k-Wave');`

to the

`startup.m`

file. If no `startup.m`

file exists, create one and save it in the MATLAB startup directory or any directory in the MATLAB path.
3

Restart MATLAB (or run

`startup`

at the command line to add the path to the current MATLAB session).
4

Open the help browser, and try running some of the examples by first selecting them and then clicking on "run the file". In MATLAB 2012a and earlier, the help browser is opened by clicking on the blue question mark icon on the menu bar, then selecting "k-Wave Toolbox" under the contents tab (see Fig. 2). In MATLAB 2012b and later, the help browser is opened by clicking on the question mark icon above "Help" on the ribbon bar, and then clicking on "Supplemental Software".

## Compiling Searchable Documentation

1

To make the k-Wave documentation searchable from the MATLAB help browser, a help database must first be compiled by running

from the command line. Note, the database that this creates will only work with the version of MATLAB used to create it.

`builddocsearchdb('...full pathname used above.../k-Wave Toolbox/helpfiles')`

from the command line. Note, the database that this creates will only work with the version of MATLAB used to create it.

**Fig. 1**Adding k-Wave to the MATLAB path

**Fig. 2**k-Wave in the MATLAB help browser