Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!l35g2000vba.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: Sat, 31 Oct 2009 23:27:46 -0700 (PDT)
Organization: http://groups.google.com
Lines: 61
Message-ID: <948dc6bf-b104-465e-96de-f862e1e843f6@l35g2000vba.googlegroups.com>
References: <hcev3g$lej$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 1257056866 2835 127.0.0.1 (1 Nov 2009 06:27:46 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 1 Nov 2009 06:27:46 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: l35g2000vba.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:581559


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.

close all, clear all, clc

f0   = 30
N    = 500
S    =  5
Ps   = 5^2/2            % = 12.5 Signal Power
N0   = 1
Pn   = 1                   % = 1   Noise Power
SNR0 = Ps/Pn        % 12.5
M    = 30                 % No. of trials

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     = S*cos(2*pi*(f0*t+rand(1,N)));
    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']
meansummary = mean(summary(:,2:4))
stdsummary  = std(summary(:,2:4))
meanSNR = meansummary(3)
stdSNR = stdsummary(3)

figure,hold on
plot(Fs,SNR0*ones(1,M),'k')
plot(Fs,meanSNR*ones(1,M),'r')
plot(Fs,(meanSNR-stdSNR)*ones(1,M),'r--')
plot(Fs,(meanSNR+stdSNR)*ones(1,M),'r--')
plot(Fs,SNR)
axis([0 M*f0 0 20])
xlabel('Sampling Frequency (Hz)')
ylabel('Signal-to-Noise Ratio')
title('SNR Estimate vs Sampling Frequency')