DSPRelated.com
Forums

noise power at a given freq for different sample durations

Started by DaveK March 16, 2009
I'm getting a puzzling result from trying to look at the spectral content
of noise and am wondering if someone could shed some light.  I'm probably
missing something very simple.  

Suppose I take a length N stationary signal and look at the normalized
power at the lowest non-zero frequency, f=1/N, of the dft.  By normalized,
I mean using Parseval's relation and also dividing by the length of the
signal.  

Suppose I then look at a sampling of the same process that's twice as long
and look at the normalized power at the second lowest frequency f=2/2N.  I
would expect to get roughly the same answer, and I do for a sine wave
input.  

However, for noise, I'm getting higher powers for shorter windows.  The
normalized power seems to scale linearly with the length of the sample, as
though I shouldn't be dividing by the sample length.  Is this the result of
windowing effects?  I tried a Hanning window, but that didn't really help.

Here's some Matlab code for this.  If n=1, we look at the power of the
lowest non-zero frequency component f=1/(sample duration).  If n=4, we
generate a sequence 4 times as long and look at the power in the
f=4/(sample duration) component.

n=8;
winsize=n*120;
t=1:winsize;
allpow=0; %running sum of power at desired frequency
numrepeats=50; %run multiple iterations to get better estimate
for repeats=1:numrepeats  
    y=randn(winsize,1); % y=sin(2*n*pi.*t./winsize+rand);
    nfft=length(y); %length of dft=length of input
    YY=fft(y,nfft); %take dft
    magy=sqrt(YY.*conj(YY)); %find magnitude of dft
    magy=magy(1:(nfft/2+1)); %cut our redundant part
    magy=magy.*sqrt(sum(y.^2)/sum(magy.^2)); %normalize (time domain
energy = freq domain energy)
    pow=magy.^2/(length(magy)-1); %strip away effect of window length
    ff=[epsilon (1:(nfft/2))./(nfft/2)];
    allpow=allpow+pow(n+1);
end
meanpow=allpow/numrepeats %average of power at desired frequency



Thanks,
Dave


On Mon, 16 Mar 2009 14:15:45 -0500, DaveK wrote:

> I'm getting a puzzling result from trying to look at the spectral > content of noise and am wondering if someone could shed some light. I'm > probably missing something very simple. > > Suppose I take a length N stationary signal and look at the normalized > power at the lowest non-zero frequency, f=1/N, of the dft. By > normalized, I mean using Parseval's relation and also dividing by the > length of the signal. > > Suppose I then look at a sampling of the same process that's twice as > long and look at the normalized power at the second lowest frequency > f=2/2N. I would expect to get roughly the same answer, and I do for a > sine wave input. > > However, for noise, I'm getting higher powers for shorter windows. The > normalized power seems to scale linearly with the length of the sample, > as though I shouldn't be dividing by the sample length. Is this the > result of windowing effects? I tried a Hanning window, but that didn't > really help. > > Here's some Matlab code for this. If n=1, we look at the power of the
(code snipped)
> > Thanks, > Dave
Without looking at your code, I think your problem is with aliasing. Unless you bandlimit the noise signal to below the Nyquist rate of your lowest sampling rate, _then_ sample, you're results aren't going to track. -- http://www.wescottdesign.com
On Mar 16, 12:15 pm, "DaveK" <licorice...@hotmail.com> wrote:
> I'm getting a puzzling result from trying to look at the spectral content > of noise and am wondering if someone could shed some light. I'm probably > missing something very simple. > > Suppose I take a length N stationary signal and look at the normalized > power at the lowest non-zero frequency, f=1/N, of the dft. By normalized, > I mean using Parseval's relation and also dividing by the length of the > signal. > > Suppose I then look at a sampling of the same process that's twice as long > and look at the normalized power at the second lowest frequency f=2/2N. I > would expect to get roughly the same answer, and I do for a sine wave > input. > > However, for noise, I'm getting higher powers for shorter windows. The > normalized power seems to scale linearly with the length of the sample, as > though I shouldn't be dividing by the sample length. Is this the result of > windowing effects? I tried a Hanning window, but that didn't really help. > > Here's some Matlab code for this. If n=1, we look at the power of the > lowest non-zero frequency component f=1/(sample duration). If n=4, we > generate a sequence 4 times as long and look at the power in the > f=4/(sample duration) component. > > n=8; > winsize=n*120; > t=1:winsize; > allpow=0; %running sum of power at desired frequency > numrepeats=50; %run multiple iterations to get better estimate > for repeats=1:numrepeats > y=randn(winsize,1); % y=sin(2*n*pi.*t./winsize+rand); > nfft=length(y); %length of dft=length of input > YY=fft(y,nfft); %take dft > magy=sqrt(YY.*conj(YY)); %find magnitude of dft > magy=magy(1:(nfft/2+1)); %cut our redundant part > magy=magy.*sqrt(sum(y.^2)/sum(magy.^2)); %normalize (time domain > energy = freq domain energy) > pow=magy.^2/(length(magy)-1); %strip away effect of window length > ff=[epsilon (1:(nfft/2))./(nfft/2)]; > allpow=allpow+pow(n+1); > end > meanpow=allpow/numrepeats %average of power at desired frequency > > Thanks, > Dave
Dave Tones and noise (and transients) are not measured in the same units. And with the same scaling. See: Choose your Units! (PWR, PSD, ESD) http://www.bksv.com/doc/bo0438.pdf In particular, the table at the bottom of the second page. Dale B. Dalrymple
On Mar 16, 4:57&#4294967295;pm, dbd <d...@ieee.org> wrote:
> On Mar 16, 12:15 pm, "DaveK" <licorice...@hotmail.com> wrote: > > > > > I'm getting a puzzling result from trying to look at the spectral content > > of noise and am wondering if someone could shed some light. &#4294967295;I'm probably > > missing something very simple. > > > Suppose I take a length N stationary signal and look at the normalized > > power at the lowest non-zero frequency, f=1/N, of the dft. &#4294967295;By normalized, > > I mean using Parseval's relation and also dividing by the length of the > > signal. > > > Suppose I then look at a sampling of the same process that's twice as long > > and look at the normalized power at the second lowest frequency f=2/2N. &#4294967295;I > > would expect to get roughly the same answer, and I do for a sine wave > > input. > > > However, for noise, I'm getting higher powers for shorter windows. &#4294967295;The > > normalized power seems to scale linearly with the length of the sample, as > > though I shouldn't be dividing by the sample length. &#4294967295;Is this the result of > > windowing effects? &#4294967295;I tried a Hanning window, but that didn't really help. > > > Here's some Matlab code for this. &#4294967295;If n=1, we look at the power of the > > lowest non-zero frequency component f=1/(sample duration). &#4294967295;If n=4, we > > generate a sequence 4 times as long and look at the power in the > > f=4/(sample duration) component. > > > n=8; > > winsize=n*120; > > t=1:winsize; > > allpow=0; %running sum of power at desired frequency > > numrepeats=50; %run multiple iterations to get better estimate > > for repeats=1:numrepeats > > &#4294967295; &#4294967295; y=randn(winsize,1); % y=sin(2*n*pi.*t./winsize+rand); > > &#4294967295; &#4294967295; nfft=length(y); %length of dft=length of input > > &#4294967295; &#4294967295; YY=fft(y,nfft); %take dft > > &#4294967295; &#4294967295; magy=sqrt(YY.*conj(YY)); %find magnitude of dft > > &#4294967295; &#4294967295; magy=magy(1:(nfft/2+1)); %cut our redundant part > > &#4294967295; &#4294967295; magy=magy.*sqrt(sum(y.^2)/sum(magy.^2)); %normalize (time domain > > energy = freq domain energy) > > &#4294967295; &#4294967295; pow=magy.^2/(length(magy)-1); %strip away effect of window length > > &#4294967295; &#4294967295; ff=[epsilon (1:(nfft/2))./(nfft/2)]; > > &#4294967295; &#4294967295; allpow=allpow+pow(n+1); > > end > > meanpow=allpow/numrepeats %average of power at desired frequency > > > Thanks, > > Dave > > Dave > > Tones and noise (and transients) are not measured in the same units. > And with the same scaling. See: > > Choose your Units! &#4294967295; (PWR, PSD, ESD)http://www.bksv.com/doc/bo0438.pdf > > In particular, the table at the bottom of the second page. > > Dale B. Dalrymple
Yes, The sine wave and broadband noise are normalized differently. The sine wave is normalized so that its peak is at a single FFT bin - this is assuming the signal occurs right on an FFT bin, otherwise you'll have scalloping losses. For broad band noise it is assumed that the noise occurs across the width of the FFT bin i.e. it is not at a particular frequency. That's also why it is referred to as a density. The difference you are seeing is likely due to the change in bin width of the FFT. Also on the B&K site given above there is a Technical Review from 1987 which discusses signals and units. Cheers, David
On Mar 16, 4:57&#4294967295;pm, dbd <d...@ieee.org> wrote:
> On Mar 16, 12:15 pm, "DaveK" <licorice...@hotmail.com> wrote: > > > > > > > I'm getting a puzzling result from trying to look at the spectral content > > of noise and am wondering if someone could shed some light. &#4294967295;I'm probably > > missing something very simple. > > > Suppose I take a length N stationary signal and look at the normalized > > power at the lowest non-zero frequency, f=1/N, of the dft. &#4294967295;By normalized, > > I mean using Parseval's relation and also dividing by the length of the > > signal. > > > Suppose I then look at a sampling of the same process that's twice as long > > and look at the normalized power at the second lowest frequency f=2/2N. &#4294967295;I > > would expect to get roughly the same answer, and I do for a sine wave > > input. > > > However, for noise, I'm getting higher powers for shorter windows. &#4294967295;The > > normalized power seems to scale linearly with the length of the sample, as > > though I shouldn't be dividing by the sample length. &#4294967295;Is this the result of > > windowing effects? &#4294967295;I tried a Hanning window, but that didn't really help. > > > Here's some Matlab code for this. &#4294967295;If n=1, we look at the power of the > > lowest non-zero frequency component f=1/(sample duration). &#4294967295;If n=4, we > > generate a sequence 4 times as long and look at the power in the > > f=4/(sample duration) component. > > > n=8; > > winsize=n*120; > > t=1:winsize; > > allpow=0; %running sum of power at desired frequency > > numrepeats=50; %run multiple iterations to get better estimate > > for repeats=1:numrepeats > > &#4294967295; &#4294967295; y=randn(winsize,1); % y=sin(2*n*pi.*t./winsize+rand); > > &#4294967295; &#4294967295; nfft=length(y); %length of dft=length of input > > &#4294967295; &#4294967295; YY=fft(y,nfft); %take dft > > &#4294967295; &#4294967295; magy=sqrt(YY.*conj(YY)); %find magnitude of dft > > &#4294967295; &#4294967295; magy=magy(1:(nfft/2+1)); %cut our redundant part > > &#4294967295; &#4294967295; magy=magy.*sqrt(sum(y.^2)/sum(magy.^2)); %normalize (time domain > > energy = freq domain energy) > > &#4294967295; &#4294967295; pow=magy.^2/(length(magy)-1); %strip away effect of window length > > &#4294967295; &#4294967295; ff=[epsilon (1:(nfft/2))./(nfft/2)]; > > &#4294967295; &#4294967295; allpow=allpow+pow(n+1); > > end > > meanpow=allpow/numrepeats %average of power at desired frequency > > > Thanks, > > Dave > > Dave > > Tones and noise (and transients) are not measured in the same units. > And with the same scaling. See: > > Choose your Units! &#4294967295; (PWR, PSD, ESD)http://www.bksv.com/doc/bo0438.pdf > > In particular, the table at the bottom of the second page. > > Dale B. Dalrymple- Hide quoted text - > > - Show quoted text -
thanks, that one is a "keeper" Mark