# 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, or using the "Set Path" button on the ribbon bar. 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 MATLAB help browser by clicking on the question mark icon above "Help" on the ribbon bar, and then select k-Wave under "Supplemental Software". 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`

2

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

Note, you will need write access to the pathdef.m file. By default, this is located at

Alternatively, the toolbox can be installed by adding the line

to the

`pathtool`

at the MATLAB command prompt, or using the "Set Path" button on the ribbon bar. 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 MATLAB help browser by clicking on the question mark icon above "Help" on the ribbon bar, and then select k-Wave under "Supplemental Software". 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(getkWavePath('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