# 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 Toolbox`

2

Add this folder to the MATLAB path. This can be done by selecting "Set Path" using the dropdown menus (File, Set Path) then clicking "Add Folder", selecting the k-Wave Toolbox folder and clicking "save" (see Fig. 1).

Alternatively, this can be done by adding the line

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.

Alternatively, this can be done by adding the line

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

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 by clicking on the blue question mark icon on the menu bar, then select 'k-Wave Toolbox' under the contents tab (see Fig. 2). To get started, try running some of the examples by first selecting them and then clicking on 'run the file'.

## Linux

1

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

`~/MATLAB/k-Wave Toolbox`

2

Add this folder to the MATLAB path. This can be done by selecting "Set Path" using the dropdown menus (File, Set Path) then clicking "Add Folder", selecting the k-Wave Toolbox folder and clicking "save" (see Fig. 1). Note, you will need write access to the pathdef.m file. By default, this is located at ...matlabroot.../toolbox/local.

Alternatively, this can be done by adding the line

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.

Alternatively, this can be done by adding the line

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

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 by clicking on the blue question mark icon on the menu bar, then select 'k-Wave Toolbox' under the contents tab (see Fig. 2). To get started, try running some of the examples by first selecting them and then clicking on 'run the file'.

## 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