# raytrace: Raytrace Through a Soundspeed Profile In PAMmisc: Miscellaneous Functions for Passive Acoustic Analysis

 raytrace R Documentation

## Raytrace Through a Soundspeed Profile

### Description

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.

### Usage

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

### Arguments

 `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 `zz` locations, meters / second `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

### Value

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.

### Author(s)

Taiki Sakai taiki.sakai@noaa.gov

### Examples

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

```

PAMmisc documentation built on Dec. 28, 2022, 1:30 a.m.