[Master Index]
[Index for /tools/hpmatlab/toolbox/signal]
spectrum
(/tools/hpmatlab/toolbox/signal/spectrum.m)
Function Synopsis
[Spec,f] = spectrum(P1,P2,P3,P4,P5,P6,P7)
Help text
SPECTRUM Power spectrum estimate of one or two data sequences.
P=SPECTRUM(X,NFFT,NOVERLAP,WIND) estimates the Power Spectral Density of
signal vector X using Welch's averaged periodogram method. The signal X
is divided into overlapping sections, each of which is detrended and
windowed by the WINDOW parameter, then zero padded to length NFFT. The
magnitude squared of the length NFFT DFTs of the sections are averaged
to form Pxx. P is a two column matrix P = [Pxx Pxxc]; the second column
Pxxc is the 95% confidence interval. The number of rows of P is NFFT/2+1
for NFFT even, (NFFT+1)/2 for NFFT odd, or NFFT if the signal X is comp-
lex. If you specify a scalar for WINDOW, a Hanning window of that length
is used.
[P,F] = SPECTRUM(X,NFFT,NOVERLAP,WINDOW,Fs) given a sampling frequency
Fs returns a vector of frequencies the same length as Pxx at which the
PSD is estimated. PLOT(F,P(:,1)) plots the power spectrum estimate
versus true frequency.
[P, F] = SPECTRUM(X,NFFT,NOVERLAP,WINDOW,Fs,Pr) where Pr is a scalar
between 0 and 1, overrides the default 95% confidence interval and
returns the Pr*100% confidence interval for Pxx instead.
SPECTRUM(X) with no output arguments plots the PSD in the current
figure window, with confidence intervals.
The default values for the parameters are NFFT = 256 (or LENGTH(X),
whichever is smaller), NOVERLAP = 0, WINDOW = HANNING(NFFT), Fs = 2,
and Pr = .95. You can obtain a default parameter by leaving it out
or inserting an empty matrix [], e.g. SPECTRUM(X,[],128).
P = SPECTRUM(X,Y) performs spectral analysis of the two sequences
X and Y using the Welch method. SPECTRUM returns the 8 column array
P = [Pxx Pyy Pxy Txy Cxy Pxxc Pyyc Pxyc]
where
Pxx = X-vector power spectral density
Pyy = Y-vector power spectral density
Pxy = Cross spectral density
Txy = Complex transfer function from X to Y = Pxy./Pxx
Cxy = Coherence function between X and Y = (abs(Pxy).^2)./(Pxx.*Pyy)
Pxxc,Pyyc,Pxyc = Confidence range.
All input and output options are otherwise exactly the same as for the
single input case.
SPECTRUM(X,Y) with no output arguments will plot Pxx, Pyy, abs(Txy),
angle(Txy) and Cxy in sequence, pausing between plots.
See also PSD, CSD, TFE, COHERE, SPECGRAM, SPECPLOT
ETFE, SPA, and ARX in the Identification Toolbox.
Cross-Reference Information
This function calls
- abs /tools/hpmatlab/toolbox/matlab/elfun/abs.m
- angle /tools/hpmatlab/toolbox/matlab/elfun/angle.m
- any /tools/hpmatlab/toolbox/matlab/ops/any.m
- conj /tools/hpmatlab/toolbox/matlab/elfun/conj.m
- detrend /tools/hpmatlab/toolbox/signal/detrend.m
- else /tools/hpmatlab/toolbox/matlab/lang/else.m
- elseif /tools/hpmatlab/toolbox/matlab/lang/elseif.m
- end /tools/hpmatlab/toolbox/matlab/lang/end.m
- error /tools/hpmatlab/toolbox/matlab/lang/error.m
- eval /tools/hpmatlab/toolbox/matlab/lang/eval.m
- fft /tools/hpmatlab/toolbox/matlab/datafun/fft.m
- fix /tools/hpmatlab/toolbox/matlab/elfun/fix.m
- for /tools/hpmatlab/toolbox/matlab/lang/for.m
- function /tools/hpmatlab/toolbox/matlab/lang/function.m
- i /tools/hpmatlab/toolbox/matlab/elmat/i.m
- if /tools/hpmatlab/toolbox/matlab/lang/if.m
- imag /tools/hpmatlab/toolbox/matlab/elfun/imag.m
- isempty /tools/hpmatlab/toolbox/matlab/ops/isempty.m
- length /tools/hpmatlab/toolbox/matlab/general/length.m
- max /tools/hpmatlab/toolbox/matlab/datafun/max.m
- nargchk /tools/hpmatlab/toolbox/matlab/lang/nargchk.m
- nargin /tools/hpmatlab/toolbox/matlab/elmat/nargin.m
- nargout /tools/hpmatlab/toolbox/matlab/elmat/nargout.m
- newplot /tools/hpmatlab/toolbox/matlab/graphics/newplot.m
- optargs /tools/hpmatlab/toolbox/signal/optargs.m
- pause /tools/hpmatlab/toolbox/matlab/lang/pause.m
- pi /tools/hpmatlab/toolbox/matlab/elmat/pi.m
- plot /tools/hpmatlab/toolbox/matlab/plotxy/plot.m
- rem /tools/hpmatlab/toolbox/matlab/elfun/rem.m
- return /tools/hpmatlab/toolbox/matlab/lang/return.m
- semilogy /tools/hpmatlab/toolbox/matlab/plotxy/semilogy.m
- size /tools/hpmatlab/toolbox/matlab/general/size.m
- specchk /tools/hpmatlab/toolbox/signal/specchk.m
- sqrt /tools/hpmatlab/toolbox/matlab/elfun/sqrt.m
- title /tools/hpmatlab/toolbox/matlab/plotxy/title.m
- xlabel /tools/hpmatlab/toolbox/matlab/plotxy/xlabel.m
- zeros /tools/hpmatlab/toolbox/matlab/elmat/zeros.m
Produced by mat2html on Wed Feb 8 12:25:18 EST 1995
Cross-Directory links are: ON