help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Blackman Harris Window ----- Confused


From: Damian Harty
Subject: RE: Blackman Harris Window ----- Confused
Date: Wed, 20 Jun 2012 10:13:55 +0000

> >I have a time series of a few hundred values, which I've detrended.
> >
> >I need to calculate a single sided spectral density function, using a
> >blackman harris window.
> >
> >I require a frequency resolution of 1/64 Hz, with a maximum of 4Hz,
> >resulting in a spectrum of 256 lines.

> Use 'pwelch', from the 'signal' package.

In general with any kind of transform, you get out what you put in - 
information is neither created nor destroyed. For 256 spectral lines you need 
to pass in 256 time domain values. If you have less than this, you need to 
"zero pad" - add zero values in the time domain signal until you have 256. Note 
that this means you aren't transforming the original signal but a new signal 
with different properties - different mean, different RMS, etc. 

If you have a number of points that is a power of two then you can take 
advantage of the "fast" implementation of the DFT, often referred to as a Fast 
Fourier Transform or FFT - octave has a command of the same name.

I'm not specifically familiar with the Blackman Harris window but a nanosecond 
on google reveals its formulation as a variant Hanning. Compute the window 
function and multiply your time domain signal by it. Then pass those values 
into a single buffer transform. You only need to use Welch's method if you have 
more than 256 points and you want to make a better estimate of the underlying 
process by making several transforms of different parts of the signal and 
averaging them together - rather grandly known as "ensemble averaging".

The 256 lines will go from -f to +f and be symmetric, you need to combine the 
results from the positive and negative spectra into one, giving you 128 lines 
in a single sided function from 0 to f. Thus you can see for your 256 
single-sided spectral density you need 512 time domain points to start with.

This feels like a piece of coursework to be completed as a learning exercise, 
which is why I suggest the explicit steps. The pwelch command is part of a 
package that doesn't come with the base installatiion of Octave and because 
it's all wrapped up in there, you don't learn much by using it.

I suggest starting by generating a signal that should transform cleanly, such 
as a sine wave, and getting a feel for it from there.

Damian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]