Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: FFT
Replies: 4   Last Post: Oct 2, 2012 5:06 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Greg Heath

Posts: 214
Registered: 12/13/04
Re: FFT
Posted: Oct 2, 2012 5:06 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Sep 30, 6:36 pm, TideMan <mul...@gmail.com> wrote:
> On Monday, October 1, 2012 9:35:08 AM UTC+13, Steve  wrote:
> > "Jennifer " <0j...@queensu.ca> wrote in message <k4a0s7$r6...@newscl01ah.mathworks.com>...
>
> > > I do not know how to use fft for given raw signal data collected at 1000Hz. I have to use MATLAB to convert the time domain signal into the frequency domain for spectral analysis.
>
> > > Could someone provide an example?
>
> > > This is what I need to do:
>
> > > % Data sampled at 1000 Hz and there are 2000 data points
>
> > > load assign1.mat
>
> > > %----------------------------------------------------------
>
> > > % Step 1: Plot the data
>
> > > figure(1);
>
> > > plot(t,y)
>
> > > xlabel('Time [s]');
>
> > > title('Raw signal data');
>
> > > %----------------------------------------------------------
>
> > > % Step 2: Compute the frequency spectrum using FFT
>
> > > ???
>
> > To transform any given time-signal into the frequency-domain you can simply use the command fft(). Try "help fft" in Matlab. To normalize the signal you have to divide by the length of the signal e.g. Y=fft(y)/length(y) ... If you want to plot the signal in the frequency domain you first should create a X-Vector for the frequency like "-fs/2:df:fs/2-df" where fs is your sampling-frequency and df your frequency-resolution. In order to plot a common spectrum you should also use the command fftshift() in Order to mirror the point f=0 into the middle.
>
> > HTH
>
> > church
>
> But this is only half the story............
> You need to transform the complex amplitudes into a magnitude using abs(Y), then to get PSD (power spectral density), you need to square the amplitudes and divide by the interval in frequency.  Finally, you should plot only the positive frequencies in a log-log plot.- Hide quoted text -
>
> - Show quoted text -


If you only show spectra at positive frequenies, multiply by 2 to
account for all of the negative frequency power except that at the
Nyquist freqency f = -Fs/2. The sum of the spectral power may not be
equal to that of the time signal power because the power at DC (f = 0)
and the Nyquist frequency (f = -Fs/2) have been ignored.

If ignoring those components bothers you, subtract the mean of the
time signal and use a low pass filter to
eliminate the Nyquist frequency component before using the fft.

Hope this helps

Greg



Date Subject Author
9/30/12
Read FFT
Jennifer
9/30/12
Read Re: FFT
dpb
9/30/12
Read Re: FFT
Steve
9/30/12
Read Re: FFT
Derek Goring
10/2/12
Read Re: FFT
Greg Heath

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.