raytrace | R Documentation |

Traces the ray of a sound through a varying soundspeed profile for a fixed amount of time. Also plots the provided sound speed profile and all traces generated. All code here is based on MATLAB code originally written by Val Schmidt from the University of New Hampshire Val Schmidt (2021). raytrace https://www.mathworks.com/matlabcentral/fileexchange/26253-raytrace), MATLAB Central File Exchange. Retrieved June 29, 2021.

```
raytrace(x0, z0, theta0, tt, zz, cc, plot = TRUE, progress = FALSE)
```

`x0` |
starting horizontal coordinate in meters |

`z0` |
starting vertical coordinate in meters |

`theta0` |
starting angle(s) of ray in degrees |

`tt` |
max travel time of ray in seconds |

`zz` |
vertical coordinates of sound speed profile (positive values are down) |

`cc` |
sound speed measurements at |

`plot` |
logical flag to plot. Can be a vector of length two to individually select plotting one of the two plots generated |

`progress` |
logical flag to show progress bar |

A list with four elements: `x`

, the horizontal
coordinates of ray path, `z`

the vertical coordinates of ray path,
`t`

actual travel time of ray in seconds,
and `d`

the total distance the ray traveled. Each individual item
in the output is a list with one entry for each `theta0`

provided.

Taiki Sakai taiki.sakai@noaa.gov

```
# Setup the sound speed profile
zz <- seq(from=0, to=5000, by=1)
cc <- 1520 + zz * -.05
cc[751:length(cc)] <- cc[750] + (zz[751:length(zz)] - zz[750])*.014
rt <- raytrace(0, 0, 5, 120, zz, cc, TRUE)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.