pwelch | R Documentation |

`pwelch`

is for single signal trace only; `mv_pwelch`

is for multiple traces. Currently `mv_pwelch`

is experimental and
should not be called directly.

```
pwelch(
x,
fs,
window = 64,
noverlap = window/2,
nfft = "auto",
window_family = hamming,
col = "black",
xlim = NULL,
ylim = NULL,
main = "Welch periodogram",
plot = 0,
log = c("xy", "", "x", "y"),
...
)
## S3 method for class ''ravetools-pwelch''
print(x, ...)
## S3 method for class ''ravetools-pwelch''
plot(
x,
log = c("xy", "x", "y", ""),
se = FALSE,
xticks,
type = "l",
add = FALSE,
col = graphics::par("fg"),
col.se = "orange",
alpha.se = 0.5,
lty = 1,
lwd = 1,
cex = 1,
las = 1,
main = "Welch periodogram",
xlab,
ylab,
xlim = NULL,
ylim = NULL,
xaxs = "i",
yaxs = "i",
xline = 1.2 * cex,
yline = 2 * cex,
mar = c(2.6, 3.8, 2.1, 0.6) * (0.5 + cex/2),
mgp = cex * c(2, 0.5, 0),
tck = -0.02 * cex,
grid = TRUE,
...
)
mv_pwelch(
x,
margin,
fs,
window = 64,
noverlap = window/2,
nfft = "auto",
window_family = hamming
)
```

`x` |
numerical vector or a row-major vector, signals.
If |

`fs` |
sample rate, average number of time points per second |

`window` |
window length in time points, default size is |

`noverlap` |
overlap between two adjacent windows, measured in time
points; default is half of the |

`nfft` |
number of points in window function; default is automatically determined from input data and window, scaled up to the nearest power of 2 |

`window_family` |
function generator for generating filter windows,
default is |

`col` , `xlim` , `ylim` , `main` , `type` , `cex` , `las` , `xlab` , `ylab` , `lty` , `lwd` , `xaxs` , `yaxs` , `mar` , `mgp` , `tck` |
parameters passed to |

`plot` |
integer, whether to plot the result or not; choices are |

`log` |
indicates which axis should be |

`...` |
will be passed to |

`se` |
logical or a positive number indicating whether to plot standard error of mean; default is false. If provided with a number, then a multiple of standard error will be drawn. This option is only available when power is in log-scale (decibel unit) |

`xticks` |
ticks to show on frequency axis |

`add` |
logical, whether the plot should be added to existing canvas |

`col.se` , `alpha.se` |
controls the color and opacity of the standard error |

`xline` , `yline` |
controls how close the axis labels to the corresponding axes |

`grid` |
whether to draw rectangular grid lines to the plot; only
respected when |

`margin` |
the margin in which |

A list with class `'ravetools-pwelch'`

that contains the
following items:

`freq`

frequencies used to calculate the 'periodogram'

`spec`

resulting spectral power for each frequency

`window`

window function (in numerical vector) used

`noverlap`

number of overlapping time-points between two adjacent windows

`nfft`

number of basis functions

`fs`

sample rate

`x_len`

input signal length

`method`

a character string

`'Welch'`

```
x <- rnorm(1000)
pwel <- pwelch(x, 100)
pwel
plot(pwel, log = "xy")
```

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.