Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!g7g2000vbi.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Effect of sampling frequency for FFT
Date: Mon, 2 Nov 2009 04:01:10 -0800 (PST)
Organization: http://groups.google.com
Lines: 120
Message-ID: <790f3493-c072-40d6-9ecd-8d1ab27d0f44@g7g2000vbi.googlegroups.com>
References: <hcev3g$lej$1@fred.mathworks.com> <948dc6bf-b104-465e-96de-f862e1e843f6@l35g2000vba.googlegroups.com> 
	<d65291df-9d35-4375-abf6-1915e52fc5c6@m1g2000vbi.googlegroups.com> 
	<hcm316$t5p$1@fred.mathworks.com>
NNTP-Posting-Host: 69.141.163.135
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1257163271 17411 127.0.0.1 (2 Nov 2009 12:01:11 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 2 Nov 2009 12:01:11 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: g7g2000vbi.googlegroups.com; posting-host=69.141.163.135; 
	posting-account=mUealwkAAACvQrLWvunjg50tRAnsNtJR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 
	2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:581789



On Nov 2, 3:51 am, "juho salminen" <jssal...@cc.hut.fi> wrote:
> Greg Heath <he...@alumni.brown.edu> wrote in message <d65291df-9d35-4375-abf6-1915e52fc...@m1g2000vbi.googlegroups.com>...
>
> > On Nov 1, 2:27 am, Greg Heath <he...@alumni.brown.edu> wrote:
> > > On Oct 30, 11:01 am, "juho salminen" <jssal...@cc.hut.fi> wrote:
>
> > > > Hi,
>
> > > > I have done some tests with artificial sinusoidial data with white noise added on it. It seems, that the higher sampling frequency I have, the better is signal to noise ratio in FFT. With this I mean, that I take FFT with constant window length, let's say 500 samples. Signal itself is kept constant, let's say 30Hz.
> > > > Highter sampling frequency then, of course, reduces the time window size.
> > > > This should simulate measurements of some sinusoid with  different sampling frequencies
>
> > > > Do you know what would cause better SNG values, when sampling frequency increases?
>
> > > SNR is independent of Fs.

-----SNIP (Revised code below)

close all, clear all, clc

f0   = 30
N    = 500
S0   = 5                 % Sinusoidal amplitude
SNR0 = 15             % Signal-to-Noise Ratio
M    = 100              % No. of trials

Ps   = S0^2/2         % 12.5      Signal Power
Pn   = Ps/SNR0      % 0.8333   Noise Power
N0   = sqrt(Pn)       % S0/sqrt(2*SNR0) = 0.9129

rand('state',0)
randn('state',0)

for i = 1:M

    Fs(i) = f0*i;        % Sampling Frequency
    dt    = 1/Fs(i);
    t     = dt*(0:N-1);
    s     = S0*cos(2*pi*(f0*t+rand));
    n     = N0*randn(1,N);

    vars(i) = var(s);
    varn(i) = var(n);
    SNR(i)  = var(s)/var(n);

end

summary = [Fs' vars' varn' SNR'];

% Restricting to Fs > 2*f0.

meansummary = mean(summary(3:M,2:4))
%  12.5174     0.8428   14.9103

stdsummary  = std(summary(3:M,2:4))
%  0.1117     0.0519    0.9746

meanSNR = meansummary(3)
stdSNR    = stdsummary(3)
Fs1        = Fs(3:M);
M1         = M-2

figure,hold on
plot(Fs1,SNR0*ones(1,M1),'k')
plot(Fs1,SNR(3:M))
plot(Fs1,meanSNR*ones(1,M1),'r')
plot(Fs1,(meanSNR-stdSNR)*ones(1,M1),'r--')
plot(Fs1,(meanSNR+stdSNR)*ones(1,M1),'r--')
legend('True SNR','SNR Estimate',...
       ['meanSNR = ',num2str(meanSNR)], ...
       ['stdSNR = ',num2str(stdSNR)],4)
axis([0 M*f0 0 20])
xlabel('Sampling Frequency (Hz)')
ylabel('Signal-to-Noise Ratio')
title('SNR Estimate vs Sampling Frequency')

Hope this helps.

Greg

> Hi,
>
> doesn't this basically mean, that there is no SNR improvement, when sampling
> frequency is increased?

Yes. I repeat:

"SNR is independent of Fs"

The example indicates that Power based estimates of SNR are  ~14.9103
+/- 0.9746
independently of Fs, when the true value is SNR = 15.

However, although your OP posed the question in terms of estimating
SNR vs Fs, your
followup post indicated that you are really interested in using the
FFT to estimate the
amplitude of a sine wave corrupted by noise.

In the latter case the simulation in my next post shows that peak-
picking FFT estimates
of both the frequency and amplitude degrade as Fs increases.

The basic reason appears to be that the FFT frequency spacing df = Fs/
N increases
as Fs increases with N = constant.

Hope this helps.

Greg