Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Power Spectral Density (PSD) questions

Subject: Power Spectral Density (PSD) questions

From: Mike Metheny

Date: 7 May, 2009 22:39:01

Message: 1 of 2

I'm not a PSD expert and am confused by some of Matlab's help for its PSD functions.

I have some accelerometer data sampled at 100 Hz, and would like to reduce it using a Hann Window with 75% overlap and a block size of 256. Through trial and error, I have come up with this:

Hs = spectrum.welch('Hann',256,75);
Hpsd = psd(Hs,y,'NFFT',256,'Fs',100);
semilogy(Hpsd.Frequencies,Hpsd.Data)

That seems to basically do what I want, but I'm not sure about the options.

First, the spectrum object -- I'm not sure what the difference is between all of these types and how it affects the PSD reduction. I have some reference data I am trying to match and no spectral estimation method is mentioned. Welch vs. periodogram vs ??

Second, the SegmentLength specified in the spectrum.welch object, that's the block size, right?

Third, NFFT in the psd() function should also be the block size, 256, correct?

Is there a better way of doing this? If anyone knows of a good primer (online or elsewhere) that would certainly be helpful.

Subject: Power Spectral Density (PSD) questions

From: Wayne King

Date: 8 May, 2009 01:06:01

Message: 2 of 2

Hi Mike, spectrum.welch() and spectrum.periodogram() are both nonparametric estimates. Which one of those methods you choose depends largely on your particular reason for trying to estimate the power spectrum. spectrum.periodogram with a rectangular window has the best frequency resolution of the nonparametric estimates, but it suffers from bias. The overlapped segment averaging in spectrum.welch improves the bias properties of the estimate, but you sacrifice frequency resolution. So with the Welch overlapped segment averaging you will get a smoother spectral estimate, but the peaks will broaden. The periodogram (with the rectangular window) will be noisier in appearance, but will have the sharpest peaks if there are line components (sinusoids) in the data. You are correct that SegmentLength is the block size in spectrum.welch() and than Nfft is the number of points used in the DFT
calculation is psd().

Hope that helps,
wayne

"Mike Metheny" <goldenchild@gmail.com> wrote in message <gtvnu5$ken$1@fred.mathworks.com>...
> I'm not a PSD expert and am confused by some of Matlab's help for its PSD functions.
>
> I have some accelerometer data sampled at 100 Hz, and would like to reduce it using a Hann Window with 75% overlap and a block size of 256. Through trial and error, I have come up with this:
>
> Hs = spectrum.welch('Hann',256,75);
> Hpsd = psd(Hs,y,'NFFT',256,'Fs',100);
> semilogy(Hpsd.Frequencies,Hpsd.Data)
>
> That seems to basically do what I want, but I'm not sure about the options.
>
> First, the spectrum object -- I'm not sure what the difference is between all of these types and how it affects the PSD reduction. I have some reference data I am trying to match and no spectral estimation method is mentioned. Welch vs. periodogram vs ??
>
> Second, the SegmentLength specified in the spectrum.welch object, that's the block size, right?
>
> Third, NFFT in the psd() function should also be the block size, 256, correct?
>
> Is there a better way of doing this? If anyone knows of a good primer (online or elsewhere) that would certainly be helpful.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us