From: John Costello on
Does Matlab have a canned set of data for FFT analysis?

What I am trying to find is a Matlab program that takes a
known set of data for a signal, computes the FFT and
extracts the spectral content and RMS equivalents of the
discrete sinusoids used to assimilate the signal...

For example, if we set up a known signal comprised of

f(t) = 5 + 2sin(2*pi*100*t) + 3sin(2*pi*1000*t)

what do we get from the Matlab FFT analysis?

thanks for any advice

john costello
From: Walter Roberson on
In article <fvnqmf$5sv$1(a)fred.mathworks.com>,
John Costello <JohnCostello(a)ChampAero.com> wrote:
>Does Matlab have a canned set of data for FFT analysis?

>What I am trying to find is a Matlab program that takes a
>known set of data for a signal, computes the FFT and
>extracts the spectral content and RMS equivalents of the
>discrete sinusoids used to assimilate the signal...

>For example, if we set up a known signal comprised of

>f(t) = 5 + 2sin(2*pi*100*t) + 3sin(2*pi*1000*t)

>what do we get from the Matlab FFT analysis?

In my recent tests... what you get is something slightly different
than the theoretical results, due to round off errors in calculations
of the sines. The difference is particularily noticable if one computes
in degrees (e.g., 25-ish cycles in 720 degrees stepping by 0.1 degrees)
and almost seemed to suggest that the sind() routine was noticably
inaccurate (the errors I found were several orders of magnitude higher
than I could account for due to a simple constant multiplier.)
Stepping over the same range in radians was *much* cleaner but errors in
the 1e-15 range in the sine calculation result in detectable non-zero
phases.

If you back transform, ifft() from impulses with 0 phasing, then
the difference against the computed sines will be very small but
measurable.
--
"The first draught serveth for health, the second for pleasure,
the third for shame, the fourth for madness." -- Sir Walter Raleigh
From: Greg Heath on
On May 5, 4:29 pm, "John Costello" <JohnCoste...(a)ChampAero.com> wrote:
> Does Matlab have a canned set of data for FFT analysis?
>
> What I am trying to find is a Matlab program that takes a
> known set of data for a signal, computes the FFT and
> extracts the spectral content and RMS equivalents of the
> discrete sinusoids used to assimilate the signal...
>
> For example, if we set up a known signal comprised of
>
> f(t) = 5 + 2sin(2*pi*100*t) + 3sin(2*pi*1000*t)
>
> what do we get from the Matlab FFT analysis?

What are you looking for?

Results depend on N and dt. The FFT imposed
period is

T = N*dt

Therefore, you should get the best results when
100*N*dt = integer.

t = dt*(0:N-1)';
df = 1/T
f = df*(0:N-1)';

Hope this helps.

Greg