Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!m1g2000vbi.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: Sun, 1 Nov 2009 21:06:34 -0800 (PST)
Organization: http://groups.google.com
Lines: 83
Message-ID: <d65291df-9d35-4375-abf6-1915e52fc5c6@m1g2000vbi.googlegroups.com>
References: <hcev3g$lej$1@fred.mathworks.com> <948dc6bf-b104-465e-96de-f862e1e843f6@l35g2000vba.googlegroups.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 1257138395 2237 127.0.0.1 (2 Nov 2009 05:06:35 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 2 Nov 2009 05:06:35 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: m1g2000vbi.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:581726



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.
>
> 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)));

      s     = S*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']
-----SNIP

% Exclude cases Fs < = 2*f0
meansummary = mean(summary(3:M,2:4))
stdsummary  = std(summary(3:M,,2:4))
> meanSNR = meansummary(3)
> stdSNR = stdsummary(3)
-----SNIP

 % Restricting to Fs > 2*f0.

Fs1 = Fs(3:M);
M1  = M-2

figure,hold on
plot(Fs1,SNR0*ones(1,M1),'k')
plot(Fs1,meanSNR*ones(1,M1),'r')
plot(Fs1,(meanSNR-stdSNR)*ones(1,M1),'r--')
plot(Fs1,(meanSNR+stdSNR)*ones(1,M1),'r--')
plot(Fs1,SNR(3:M))

> 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