1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>pwelch</title>
<style type="text/css" media="all">
@import url("scilab_code.css");
@import url("xml_code.css");
@import url("c_code.css");
@import url("style.css");
</style>
</head>
<body>
<div class="manualnavbar">
<table width="100%"><tr>
<td width="30%">
<span class="previous"><a href="pulstran.html"><< pulstran</a></span>
</td>
<td width="40%" class="center">
<span class="top"><a href="section_cc2bc01c47967d47fcf3507a91d572ba.html">FOSSEE Signal Processing Toolbox</a></span>
</td>
<td width="30%" class="next">
<span class="next"><a href="pyulear.html">pyulear >></a></span>
</td>
</tr></table>
<hr />
</div>
<span class="path"><a href="index.html">FOSSEE Signal Processing Toolbox</a> >> <a href="section_cc2bc01c47967d47fcf3507a91d572ba.html">FOSSEE Signal Processing Toolbox</a> > pwelch</span>
<br /><br />
<div class="refnamediv"><h1 class="refname">pwelch</h1>
<p class="refpurpose">Estimate power spectral density of data "x" by the Welch (1967) periodogram/FFT method.</p></div>
<div class="refsynopsisdiv"><h3 class="title">Calling Sequence</h3>
<div class="synopsis"><pre><span class="default">[</span><span class="default">spectra</span><span class="default">,</span><span class="default">freq</span><span class="default">] = </span><span class="functionid">pwelch</span><span class="default">(</span><span class="default">x</span><span class="default">, </span><span class="default">window</span><span class="default">, </span><span class="default">overlap</span><span class="default">, </span><span class="default">Nfft</span><span class="default">, </span><span class="default">Fs</span><span class="default">, </span><span class="default">range</span><span class="default">, </span><span class="default">plot_type</span><span class="default">, </span><span class="default">detrend</span><span class="default">, </span><span class="default">sloppy</span><span class="default">)</span>
<span class="default">[</span><span class="default">spectra</span><span class="default">,</span><span class="default">freq</span><span class="default">] = </span><span class="functionid">pwelch</span><span class="default">(</span><span class="default">x</span><span class="default">, </span><span class="default">y</span><span class="default">, </span><span class="default">window</span><span class="default">, </span><span class="default">overlap</span><span class="default">, </span><span class="default">Nfft</span><span class="default">, </span><span class="default">Fs</span><span class="default">, </span><span class="default">range</span><span class="default">, </span><span class="default">plot_type</span><span class="default">, </span><span class="default">detrend</span><span class="default">, </span><span class="default">sloppy</span><span class="default">, </span><span class="default">results</span><span class="default">)</span>
<span class="default">[</span><span class="default">spectra</span><span class="default">,</span><span class="default">Pxx_ci</span><span class="default">,</span><span class="default">freq</span><span class="default">] = </span><span class="functionid">pwelch</span><span class="default">(</span><span class="default">x</span><span class="default">, </span><span class="default">window</span><span class="default">, </span><span class="default">overlap</span><span class="default">, </span><span class="default">Nfft</span><span class="default">, </span><span class="default">Fs</span><span class="default">, </span><span class="default">conf</span><span class="default">, </span><span class="default">range</span><span class="default">, </span><span class="default">plot_type</span><span class="default">, </span><span class="default">detrend</span><span class="default">, </span><span class="default">sloppy</span><span class="default">)</span>
<span class="default">[</span><span class="default">spectra</span><span class="default">,</span><span class="default">Pxx_ci</span><span class="default">,</span><span class="default">freq</span><span class="default">] = </span><span class="functionid">pwelch</span><span class="default">(</span><span class="default">x</span><span class="default">, </span><span class="default">y</span><span class="default">, </span><span class="default">window</span><span class="default">, </span><span class="default">overlap</span><span class="default">, </span><span class="default">Nfft</span><span class="default">, </span><span class="default">Fs</span><span class="default">, </span><span class="default">conf</span><span class="default">, </span><span class="default">range</span><span class="default">, </span><span class="default">plot_type</span><span class="default">, </span><span class="default">detrend</span><span class="default">, </span><span class="default">sloppy</span><span class="default">, </span><span class="default">results</span><span class="default">)</span></pre></div></div>
<div class="refsection"><h3 class="title">Parameters</h3>
<dl><dt><span class="term">x:</span>
<dd><p class="para">[non-empty vector] system-input time-series data</p></dd></dt>
<dt><span class="term">y:</span>
<dd><p class="para">[non-empty vector] system-output time-series data</p></dd></dt>
<dt><span class="term">window:</span>
<dd><p class="para">[real vector] of window-function values between 0 and 1; the data segment has the same length as the window. Default window shape is Hamming. [integer scalar] length of each data segment. The default value is window=sqrt(length(x)) rounded up to the nearest integer power of 2; see 'sloppy' argument.</p></dd></dt>
<dt><span class="term">overlap:</span>
<dd><p class="para">[real scalar] segment overlap expressed as a multiple of window or segment length. 0 <= overlap < 1, The default is overlap=0.5 .</p></dd></dt>
<dt><span class="term">Nfft:</span>
<dd><p class="para">[integer scalar] Length of FFT. The default is the length of the "window" vector or has the same value as the scalar "window" argument. If Nfft is larger than the segment length, "seg_len", the data segment is padded with "Nfft-seg_len" zeros. The default is no padding. Nfft values smaller than the length of the data segment (or window) are ignored silently.</p></dd></dt>
<dt><span class="term">Fs:</span>
<dd><p class="para">[real scalar] sampling frequency (Hertz); default=1.0</p></dd></dt>
<dt><span class="term">conf:</span>
<dd><p class="para">[real scalar] confidence level between 0 and 1. Confidence intervals of the spectral density are estimated from scatter in the periodograms and are returned as Pxx_ci. Pxx_ci(:,1) is the lower bound of the confidence interval and Pxx_ci(:,2) is the upper bound. If there are three return values, or conf is an empty matrix, confidence intervals are calculated for conf=0.95 . If conf is zero or is not given, confidence intervals are not calculated. Confidence intervals can be obtained only for the power spectral density of x; nothing else.</p></dd></dt>
<dt><span class="term">range:</span>
<dd><p class="para"></p></dd></dt>
<dt><span class="term">'half', 'onesided' :</span>
<dd><p class="para">frequency range of the spectrum is zero up to but not including Fs/2. Power from negative frequencies is added to the positive side of the spectrum, but not at zero or Nyquist (Fs/2) frequencies. This keeps power equal in time and spectral domains. See reference [2].</p></dd></dt>
<dt><span class="term">'whole', 'twosided' :</span>
<dd><p class="para">frequency range of the spectrum is -Fs/2 to Fs/2, with negative frequencies stored in "wrap around" order after the positive frequencies; e.g. frequencies for a 10-point 'twosided' spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1</p></dd></dt>
<dt><span class="term">'shift', 'centerdc' :</span>
<dd><p class="para">same as 'whole' but with the first half of the spectrum swapped with second half to put the zero-frequency value in the middle. (See "help fftshift". If data (x and y) are real, the default range is 'half', otherwise default range is 'whole'.</p></dd></dt>
<dt><span class="term">plot_type:</span>
<dd><p class="para"></p></dd></dt>
<dt><span class="term">'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':</span>
<dd><p class="para">specifies the type of plot. The default is 'plot', which means linear-linear axes. 'squared' is the same as 'plot'. 'dB' plots "10*log10(psd)". This argument is ignored and a spectrum is not plotted if the caller requires a returned value.</p></dd></dt>
<dt><span class="term">detrend:</span>
<dd><p class="para">'no-strip', 'none' -- do NOT remove mean value from the data 'short', 'mean' -- remove the mean value of each segment from each segment of the data.</p></dd></dt>
<dt><span class="term">sloppy:</span>
<dd><p class="para">FFT length is rounded up to the nearest integer power of 2 by zero padding. FFT length is adjusted after addition of padding by explicit Nfft argument. The default is to use exactly the FFT and window.</p></dd></dt></dl></div>
<div class="refsection"><h3 class="title">Description</h3>
<p class="para">Estimate power spectral density of data "x" by the Welch (1967) periodogram/FFT method. The data is divided into segments. If "window" is a vector, each segment has the same length as "window" and is multiplied by "window" before (optional) zero-padding and calculation of its periodogram. If "window" is a scalar, each segment has a length of "window" and a Hamming window is used. The spectral density is the mean of the periodograms, scaled so that area under the spectrum is the same as the mean square of the data. This equivalence is supposed to be exact, but in practice there is a mismatch of up to 0.5% when comparing area under a periodogram with the mean square of the data.</p></div>
<br />
<div class="manualnavbar">
<table width="100%">
<tr><td colspan="3" class="next"><a href="http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab%20software&component=Documentation%20pages" class="ulink">Report an issue</a></td></tr>
<tr>
<td width="30%">
<span class="previous"><a href="pulstran.html"><< pulstran</a></span>
</td>
<td width="40%" class="center">
<span class="top"><a href="section_cc2bc01c47967d47fcf3507a91d572ba.html">FOSSEE Signal Processing Toolbox</a></span>
</td>
<td width="30%" class="next">
<span class="next"><a href="pyulear.html">pyulear >></a></span>
</td>
</tr></table>
<hr />
</div>
</body>
</html>
|