Thread Subject: Need help with Fourier transform

Subject: Need help with Fourier transform

From: Steve Amphlett

Date: 2 Sep, 2009 14:46:04

Message: 1 of 3

<holding head in shame>

If I want to track single frequencies, I can write code like this:

%%%%%%%%%%%%%%%%%code%%%%%%%%%%%%%%

%Time
t=10*(0:32767)'/32768;

% Pass??
n=(1:length(t))';
n=[n n];

% My signal - pure real at 10, a mix at 5
x=3*cos(10*2*pi*t)+7*sin(5*2*pi*t+0.2);

% Dig out the 5 and plot it
re=cos(5*2*pi.*t).*x;
im=sin(5*2*pi.*t).*x;
[sum(re) sum(im)]/length(t)*2

mag=cumsum([re im])./n*2;

subplot(211)
plot(t,mag)

% Dig out the 10 and plot it
re=cos(10*2*pi.*t).*x;
im=sin(10*2*pi.*t).*x;
[sum(re) sum(im)]/length(t)*2

mag=cumsum([re im])./n*2;

subplot(212)
plot(t,mag)

%%%%%%%%%%%%%%%%%code%%%%%%%%%%%%%%


So I can recover the amplitudes of the real and imag components in my fake signal with the summations. But what about the wiggles in the plots?

</holding head in shame>

Subject: Need help with Fourier transform

From: Rune Allnor

Date: 2 Sep, 2009 16:38:32

Message: 2 of 3

On 2 Sep, 16:46, "Steve Amphlett" <Firstname.Lastn...@Where-I-
Work.com> wrote:

> If I want to track single frequencies, I can write code like this:
...
> So I can recover the amplitudes of the real and imag components in my fake signal with the summations.  But what about the wiggles in the plots?

...so what you do is to use an integrator to accumulate
the energy of each nominal frequency band...?

One effect that contributes to the wiggles is the cross-talk
between the crequency components. Umless the two sines are
orthogonal, they will interact with a coupling factor that is
given by the sinc window function at any given N.

And since N varies all the time - if I understand your code
correctly - the coupling factor also changes all the time,
switching between positive and negative, and sliding further
and further apart in spectrum domain.

Rune

Subject: Need help with Fourier transform

From: Steve Amphlett

Date: 2 Sep, 2009 17:59:19

Message: 3 of 3

Rune Allnor <allnor@tele.ntnu.no> wrote in message <b6dff0b3-e1f3-40c7-bff3-6118dda5a8a3@c37g2000yqi.googlegroups.com>...
> On 2 Sep, 16:46, "Steve Amphlett" <Firstname.Lastn...@Where-I-
> Work.com> wrote:
>
> > If I want to track single frequencies, I can write code like this:
> ...
> > So I can recover the amplitudes of the real and imag components in my fake signal with the summations. ?But what about the wiggles in the plots?
>
> ...so what you do is to use an integrator to accumulate
> the energy of each nominal frequency band...?
>
> One effect that contributes to the wiggles is the cross-talk
> between the crequency components. Umless the two sines are
> orthogonal, they will interact with a coupling factor that is
> given by the sinc window function at any given N.
>
> And since N varies all the time - if I understand your code
> correctly - the coupling factor also changes all the time,
> switching between positive and negative, and sliding further
> and further apart in spectrum domain.
>
> Rune
Cycle-by-cycle update perhaps? Integrators reset.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
code Sprinceana 2 Sep, 2009 12:48:39
fourier Sprinceana 2 Sep, 2009 12:48:35
fourier transform Sprinceana 2 Sep, 2009 12:48:35
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com