[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

Produced by mat2html on Wed Feb 8 12:25:18 EST 1995
Cross-Directory links are: ON