I am trying to do some spectral estimation using the DFT using a rectangular window only and i would like my estimates to be as acurate as possible. The sequence to be transformed is a time series, not exactly gaussian,.. (and i cant make any real assumptions about stationary and such at thsi point.) What i do have at my liberty is the ability to chose the record length at any given measurment, so heres my question. Could i get better spectral estimates (both amplitude AND phase) by choosing the record length such that the beginning sample call it x[0] and the last sample x[N-1] closely match? I guess trying to emulate what window functions do. That is if i had a choise to do the DFT over 135 samples vs doing the DFT over say 128 samples because at point x[134], that data point looks closer to what i had at x[0]. Would my spectral leakage be less, because the sequence looks more periodic?

# Reducing Spectral Leakage of Rectangular Window?

Started by ●April 17, 2012

Reply by ●April 17, 20122012-04-17

On 4/17/12 11:07 AM, westocl wrote:> I am trying to do some spectral estimation using the DFT using a > rectangular window only and i would like my estimates to be as acurate as > possible. The sequence to be transformed is a time series, not exactly > gaussian,.. (and i cant make any real assumptions about stationary and such > at thsi point.) > > What i do have at my liberty is the ability to chose the record length at > any given measurment, so heres my question. > > Could i get better spectral estimates (both amplitude AND phase) by > choosing the record length such that the beginning sample call it x[0] and > the last sample x[N-1] closely match? I guess trying to emulate what window > functions do. > > That is if i had a choise to do the DFT over 135 samples vs doing the > DFT over say 128 samples because at point x[134], that data point looks > closer to what i had at x[0]. Would my spectral leakage be less, because > the sequence looks more periodic?yeah, it would likely look better. what you want is that x[N] (the first sample you're cutting off) looks just like x[0] and you want x[N-1] (also cut off) to look just like x[1], and you want x[N-2] to look like x[2]. and then do a 135-point (or whatever number) DFT, *not* a zero-padded 256-point DFT. then you can consider the DFT to be identical to the DFS (it is anyway) and that you are transforming one periodic sequence in the time domain, to another periodic sequence in the frequency domain. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."

Reply by ●April 17, 20122012-04-17

On Tuesday, April 17, 2012 8:07:24 AM UTC-7, westocl wrote:> I am trying to do some spectral estimation using the DFT using a > rectangular window only and i would like my estimates to be as acurate as > possible. The sequence to be transformed is a time series, not exactly > gaussian,.. (and i cant make any real assumptions about stationary and such > at thsi point.)Define accurate? Low variance? Low bias? Why rectangular window only? What is the real goal? Just power spectral density estimation? To what end? These questions drive what method you may need to use.> What i do have at my liberty is the ability to chose the record length at > any given measurment, so heres my question. > > Could i get better spectral estimates (both amplitude AND phase) by > choosing the record length such that the beginning sample call it x[0] and > the last sample x[N-1] closely match? I guess trying to emulate what window > functions do. > > That is if i had a choise to do the DFT over 135 samples vs doing the > DFT over say 128 samples because at point x[134], that data point looks > closer to what i had at x[0]. Would my spectral leakage be less, because > the sequence looks more periodic?Depends again by what you're using the spectrum for. If you're estimating a single sinusoidal frequency, the variance of the estimator (using the CRLB for a sinusoid embedded in white noise) is lower bounded proportional to 1/N^3, making it extremely sensitive to data record length even if you use the optimal estimator. But in terms of spectral leakage, or side lobe amplitude, yes, there's a good chance it should be decreased. Note that the Discrete Cosine Transform achieves this by enforcing even symmetry (depending on the type) when the periodic extension inherent in the transform is manifested. If you're looking to estimate narrow band, impulsive spectrum, then you may consider some other methods. AR methods using linear prediction to extrapolate the signal outside of it's known values, eliminating side lobes. Bryan

Reply by ●April 17, 20122012-04-17

On 4/17/2012 8:07 AM, westocl wrote:> Could i get better spectral estimates (both amplitude AND phase) by > choosing the record length such that the beginning sample call it x[0] and > the last sample x[N-1] closely match?If you match the value and the first derivative then it will be even better in this regard. And you can go from there but even this is probably hard enough to accomplish. That is, if you pick the same value .. and just for convenience let's say that it's a zero-crossing .. then if the next value is positive at the beginning and if the next-to-last sample is also positive then there's a break in the slope which will generate spectral leakage .. i.e. new frequency components. You would want, for example, the second sample to be positive/negative matched by the next-to-last sample to be negative/positive for continuity of slope. Then you could use the same idea for the second derivative .. and so forth. But, as above, it gets harder to actually accomplish. Performance will vary. Consider a rectangular window applied to a sinusoid. If an integer number of periods are grabbed exactly then there will be no spectral spreading. If an integer plus 1/2 periods are grabbed then I believe it's likely to be the worst case. And, in that situation, there are two interesting cases: - when the end values are +1 and -1; causing the max discontinuity in values - when the end values are equal and zero; causing the max discontinuity in the slope. In this case you can't have both because of the selected span of the window. And, it's likely that the value mismatch is the worst in terms of spectral spreading .. but I've not figured that out. Fred

Reply by ●April 17, 20122012-04-17

On 4/17/2012 10:41 AM, Fred Marshall wrote:> In this case you can't have both because of the selected span of the > window. And, it's likely that the value mismatch is the worst in terms > of spectral spreading .. but I've not figured that out.And then, of course, you have the problem (if it is a problem) that the spectral sample intervals might change for every sample. That seems inconvenient to say the least. Fred

Reply by ●April 17, 20122012-04-17

>On 4/17/2012 10:41 AM, Fred Marshall wrote: >> In this case you can't have both because of the selected span of the >> window. And, it's likely that the value mismatch is the worst in terms >> of spectral spreading .. but I've not figured that out. > >And then, of course, you have the problem (if it is a problem) that the >spectral sample intervals might change for every sample. That seems >inconvenient to say the least. > >Fred >Understood... So the general feel is that I can do atleast somewhat better by taking a DFT record length that looks to be visually periodic instead of blindly taking a record length? Everyone in agreance?

Reply by ●April 17, 20122012-04-17

westocl <cweston_@n_o_s_p_a_m.hotmail.com> wrote:> I am trying to do some spectral estimation using the DFT using a > rectangular window only and i would like my estimates to be as acurate as > possible. The sequence to be transformed is a time series, not exactly > gaussian,.. (and i cant make any real assumptions about stationary > and such at thsi point.)> What i do have at my liberty is the ability to chose the record > length at any given measurment, so heres my question.> Could i get better spectral estimates (both amplitude AND phase) by > choosing the record length such that the beginning sample call it > x[0] and the last sample x[N-1] closely match? I guess trying to > emulate what window functions do.Do autocorrelation, find a peak that isn't too close to zero, maybe the biggest one, and use that as the length. You want something that is close to a period of the signal, assuming that there is some periodicity to it. That is what autocorrelation does. Matching just the points, as someone else noted, might give you an odd multiple of a half cycle. You might also look at the DST, which applies to signals that go to zero on each end, and works on multiples of a half cycle. -- glen

Reply by ●April 17, 20122012-04-17

On Tuesday, April 17, 2012 11:05:43 AM UTC-7, westocl wrote:> >On 4/17/2012 10:41 AM, Fred Marshall wrote: > >> In this case you can't have both because of the selected span of the > >> window. And, it's likely that the value mismatch is the worst in terms > >> of spectral spreading .. but I've not figured that out. > > > >And then, of course, you have the problem (if it is a problem) that the > >spectral sample intervals might change for every sample. That seems > >inconvenient to say the least. > > > >Fred > > > > Understood... So the general feel is that I can do atleast somewhat better > by taking a DFT record length that looks to be visually periodic instead of > blindly taking a record length? > > Everyone in agreance?"Better" in what regard? You clearly didn't read my response.

Reply by ●April 17, 20122012-04-17

On Apr 17, 2:33�pm, Bryan <bryan.p...@gmail.com> wrote:> You clearly didn't read my responseAre you female?

Reply by ●April 17, 20122012-04-17

On Tuesday, April 17, 2012 11:41:30 AM UTC-7, brent wrote:> On Apr 17, 2:33�pm, Bryan > wrote: > > > You clearly didn't read my response > > > Are you female?...asks the guy who's been flooding the forum with junk by interacting with Bret. I like to help when people ask questions, but obviously not when people refuse to listen to answers.