Matlab谱密度函数的求教
调用psd(h,x,'Fs',Fs)这个程序的时候,x是原数据,Fs是频率,h是代表什么呢?另外,我看psd这个程序画图的时候是用这个命令
plot(freq_vector,10*log10(abs(P)))
我想把freq_vector和10*log10(abs(P))的数据导出来
试过给aa=freq_vector,bb=10*log10(abs(P))
加在程序最后,但是不行
请问有什么好办法吗?
谢谢
[ 本帖最后由 xuebx 于 2006-9-8 08:24 编辑 ] Introduction
The Signal Processing Toolbox provides several command line functions to perform spectral analysis, including classical (non-parametric) techniques, parametric techniques, and eigenvector (or subspace) techniques. In addition, objects have been added which enhance the usability, and visualization capabilities to these functions. There are nine classes representing the following spectral analysis algorithms.
Periodogram
Welch
MTM (Thomson multitaper method)
Burg
Covariance
Modified Covariance
Yule-Walker
MUSIC (Multiple Signal Classification)
Eigenvector
Default Spectrum Object
You can instantiate a spectrum object without specifying any input arguments. For example, the following creates a default periodogram spectrum object with default settings.
h = spectrum.periodogram
h =
EstimationMethod: 'Periodogram'
WindowName: 'Rectangular'
Specifying Parameters at Object Instantiation
Specifying parameter values at object construction time requires that you specify the parameters in the order listed in the help. Type "help spectrum.welch" for an example. When instantiating a Welch object you can't specify segment length without specifying window name. However, as you will see later in this demo you can always set any parameter after the object is created.
Here's an example of specifying several of the object's parameter values at construction time.
h = spectrum.welch('kaiser',66,50)
h =
EstimationMethod: 'Welch'
SegmentLength: 66
OverlapPercent: 50
WindowName: 'Kaiser'
Beta: 0.5000
Changing Property Values after Object Instantiation
You can set the value of any parameter, except for the EstimationMethod, using either dot-notation or the set method. Here's how you set the window of the Welch object created above using dot-notation.
h.WindowName = 'Chebyshev'
h =
EstimationMethod: 'Welch'
SegmentLength: 66
OverlapPercent: 50
WindowName: 'Chebyshev'
SidelobeAtten: 100
Note that the Chebyshev window has a sidelobe attenuation parameter, which dynamically appears in the list of properties.
To specify a window parameter you must enclose the window name and the parameter value in a cell array. Here's how you can specify the sidelobe attenuation value for the Chebyshev window:
h = spectrum.welch({'Chebyshev',80})
h =
EstimationMethod: 'Welch'
SegmentLength: 64
OverlapPercent: 50
WindowName: 'Chebyshev'
SidelobeAtten: 80
Spectral Estimation Methods
Some of the most important methods of the spectrum objects are psd, msspectrum, and pseudospectrum. The psd method returns the power spectral density (PSD). The msspectrum method returns the mean-square (power) spectrum (MSS) calculated by the periodogram or Welch spectral estimation technique. The pseudospectrum method returns the pseudospectrum calculated by the MUSIC or eigenvector estimation technique. All of these methods will plot the spectrum if no output argument is specified.
The PSD is a measure of power per unit of frequency, hence it has units of power/frequency. For example, for a sequence of voltage measurements the units of the PSD are volts^2/Hz. The MSS, on the other hand, is a measure of power at specific frequency and has units of power. Continuing our example where the signal is voltage measurements the units would be volts^2.
All three of these methods (psd, msspectrum, and pseudospectrum) have the same syntax. They require a spectrum object as the first input and the signal to measure the power as the second input argument. Then you can optionally specify property-value pairs for the sampling frequency, the spectrum range, and the number of FFT points, etc.
Alternatively you can invoke the psdotps method on a spectrum object, which returns an options object with default values for these and other parameters. For example:
h = spectrum.welch;
hopts = psdopts(h)
hopts =
NFFT: 'Nextpow2'
NormalizedFrequency: true
Fs: 'Normalized'
SpectrumType: 'Onesided'
CenterDC: false
produces an options object hopts which contains the list of optional parameters that can be passed to the psd method. This options object can now be used in multiple calls to the psd method.
You can then set the value of any of the properties of the options object hopts and pass hotps to the psd method. There are corresponding msspectrumopts and pseudospectrumopts methods that return options objects to be used with the msspectrum and pseudospectrum methods, respectively.
更多详细的内容你可以查看:http://www.mathworks.com/products/signal/demos.html?file=/products/demos/shipping/signal/spectralanalysisobjsdemo.html
页:
[1]