Path: news.mathworks.com!not-for-mail
From: "Per Sundqvist" <per.sundqvist@uam.es>
Newsgroups: comp.soft-sys.matlab
Subject: Re: fft, frequecy of a signal
Date: Tue, 17 Jun 2008 14:00:24 +0000 (UTC)
Organization: Chalmers Tekniska H&#246;gskola
Lines: 51
Message-ID: <g38g1o$7js$1@fred.mathworks.com>
References: <g355te$q0r$1@fred.mathworks.com> <zvJ5k.12906$Ri.2282@flpi146.ffdc.sbc.com> <g37quk$et6$1@fred.mathworks.com> <g387sh$48v$1@canopus.cc.umanitoba.ca> <g38daq$671$1@fred.mathworks.com>
Reply-To: "Per Sundqvist" <per.sundqvist@uam.es>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1213711224 7804 172.30.248.35 (17 Jun 2008 14:00:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 Jun 2008 14:00:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 266682
Xref: news.mathworks.com comp.soft-sys.matlab:474239



"Bryan " <bdg146.removeThis@gmail.com> wrote in message
<g38daq$671$1@fred.mathworks.com>...
> roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in 
> message <g387sh$48v$1@canopus.cc.umanitoba.ca>...
> > Standard definition of frequency: samples per second.
> > So divide the number of samples (the length) by the 
> total time.
> > (Provided, that is, that the signal was sampled at 
> regular
> > intervals.)
> > -- 
> >   "Prevention is the daughter of intelligence."
> >                                               -- Sir 
> Walter Raleigh
> 
> 
> I'm new to a lot of this, so this question is as much for 
> my own understanding as it is for the original poster.
> 
> Wouldn't this depend on the 'type' of frequency they are 
> looking for?  Taking the number of samples and dividing by 
> the total time would give them the sampling frequency, but 
> not the frequency of the analog signal that was sampled.  
> For instance, you can have a 1 Hz signal that is sampled 
> at 1 MHz.  (# of samples) / (total time) would equal 1 
> MHz, but that isn't the frequency of the signal, which is 
> 1 Hz.
> 
> Does that make any sense or am I totally off-base here?

If you use fft you would get a frequency spectra. Assuming
that you have sampled the signal over many periods and small
time steps you would get a sharp maximum at "the frequency".
If you only have one period, you would get other components
of frequency. This phenomenon is similar to Heissenbergs
uncertinity principle.

Now fft is not so user-friendly, but if you look through the
example:
<a
href="http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/fft.html">fft-example</a>

(http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/fft.html)

Then, "the frequency" will approximately be obtained by:
[dummy,ix]=sort(abs(Y(1:NFFT/2));
f_max=f(ix(end)) %the dominating frequency component

Good luck,
Per