Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
URGENT: Fourier Series coefficients!

Subject: URGENT: Fourier Series coefficients!

From: hot_bodrod@2die4.com (Willie)

Date: 26 Oct, 2003 06:18:56

Message: 1 of 8

Hi,

I am new at matlab and I need to write a MATLAB function that computes
the discrete-time fourier series coefficients of a periodic signal. I
know that the function should be of the form:
a = dtfs(x, pos) , where a = vector of coeff., x = vector containing
one period of the signal, and pos = gives the time-index of the first
value of the x vector.
I also need the inverse of the above function.
All this to do some stupid fourier series plots!
P.S. I do not want to use any of the Fourier transforms built in
Matlab.
Any help is appreciated
Thanx

Subject: URGENT: Fourier Series coefficients!

From: allnor@tele.ntnu.no (Rune Allnor)

Date: 26 Oct, 2003 11:57:40

Message: 2 of 8

hot_bodrod@2die4.com (Willie) wrote in message news:<857ff49b.0310260618.1701e79b@posting.google.com>...
> Hi,
>
> I am new at matlab and I need to write a MATLAB function that computes
> the discrete-time fourier series coefficients of a periodic signal. I
> know that the function should be of the form:
> a = dtfs(x, pos) , where a = vector of coeff., x = vector containing
> one period of the signal, and pos = gives the time-index of the first
> value of the x vector.
> I also need the inverse of the above function.

You are taking a class on basic DSP, right? Check your text book if
yoy find the "Fourier basis matrix" or "Fourier tranform matrix".
It is usually designated as W in textbooks. Just build that matrix,
multiply with the data (column) vector and the resulting vector
is your Fourier coefficients.

The inverse transform is equally easy to implement as a multiplication
with the inverse matrix, W^(-1). Both W and W^(-1) are available as
closed-form expressions, no linear algebra is necessary.

> All this to do some stupid fourier series plots!

Eh... Fourier plots are not stupid at all, but actually some of the most
useful tools available for signal analysis and quite a few other things.
And it often backfires to use the word "urgent" in the header, and then
call the question "stupid" in the text of your post.

> P.S. I do not want to use any of the Fourier transforms built in
> Matlab.

And that's the way you learn how the Fourier methods work.

Rune

Subject: URGENT: Fourier Series coefficients!

From: Duane Bozarth

Date: 26 Oct, 2003 19:40:49

Message: 3 of 8

Rune Allnor wrote:
>
> hot_bodrod@2die4.com (Willie) wrote in message news:<857ff49b.0310260618.1701e79b@posting.google.com>...

...snip an "urgent" request...

> > All this to do some stupid fourier series plots!
>
> Eh... Fourier plots are not stupid at all, but actually some of the most
> useful tools available for signal analysis and quite a few other things.
> And it often backfires to use the word "urgent" in the header, and then
> call the question "stupid" in the text of your post.

Worked to dissuade me <quite> effectively... :)

Subject: URGENT: Fourier Series coefficients!

From: hot_bodrod@2die4.com (Willie)

Date: 26 Oct, 2003 18:19:22

Message: 4 of 8

Thanx for ur reply, but i am sorry to tell you that i don't think that
what you suggested will do. See I have to write matlab code for what i
described earlier and not mere calculations!
Thanx again and I appreciate it if you could still help on this issue

Subject: URGENT: Fourier Series coefficients!

From: allnor@tele.ntnu.no (Rune Allnor)

Date: 26 Oct, 2003 23:33:29

Message: 5 of 8

Duane Bozarth <dp_bozarth@swko.dot.net> wrote in message news:<3F9C77A1.3105E8B4@swko.dot.net>...
> Rune Allnor wrote:
> >
> > hot_bodrod@2die4.com (Willie) wrote in message news:<857ff49b.0310260618.1701e79b@posting.google.com>...
>
> ...snip an "urgent" request...
>
> > > All this to do some stupid fourier series plots!
> >
> > Eh... Fourier plots are not stupid at all, but actually some of the most
> > useful tools available for signal analysis and quite a few other things.
> > And it often backfires to use the word "urgent" in the header, and then
> > call the question "stupid" in the text of your post.
>
> Worked to dissuade me <quite> effectively... :)

Yep, I was really about to just skip it when I saw that very last line
about not using built-in functions. I don't see that very often, so...

Rune

Subject: URGENT: Fourier Series coefficients!

From: Duane Bozarth

Date: 27 Oct, 2003 07:19:16

Message: 6 of 8

Willie wrote:
>
> Thanx for ur reply, but i am sorry to tell you that i don't think that
> what you suggested will do. See I have to write matlab code for what i
> described earlier and not mere calculations!
> Thanx again and I appreciate it if you could still help on this issue

Matlab code <is> description of calculations...unless you're speaking of
symbolic manipulation???

Subject: URGENT: Fourier Series coefficients!

From: hot_bodrod@2die4.com (Willie)

Date: 27 Oct, 2003 12:39:20

Message: 7 of 8

Sorry once more,
Maybe i am not making my self clear because, I myself am confused.
What I would like to do, is write code for finding the fourier series
coefficients, as described above. I would like the code to not have
any already built in fourier functions in matlab. This code that I
will obtain, I am going to use in matlab to generate these
coefficients and hence plot them.
Thanx again! (both of you guys :) )

Subject: URGENT: Fourier Series coefficients!

From: poespam-trap@yahoo.com (Randy Poe)

Date: 27 Oct, 2003 13:18:28

Message: 8 of 8

hot_bodrod@2die4.com (Willie) wrote in message news:<857ff49b.0310261819.188a28fe@posting.google.com>...
> Thanx for ur reply, but i am sorry to tell you that i don't think that
> what you suggested will do. See I have to write matlab code for what i
> described earlier and not mere calculations!
> Thanx again and I appreciate it if you could still help on this issue

The suggestion offered by Rune Allnor told you how to
write the Matlab code. All you have to do is look up the
expressions for those equations and implement them in
Matlab.

We're all a little unclear on what you want, since you are
asking for Matlab code to calculate something but without
doing calculations (?).

I suggest you start with writing down the expressions for
the Fourier coefficients. Then you can rephrase your
question: "I have a vector x representing time samples. I
need to calculate the Fourier coefficients using this
equation (you really should do the minimal effort of
looking up the equation). Can someone help me implement
it?"

Among other things, it's not clear whether it's Fourier
series you're struggling with, or just how to implement it
in Matlab.

         - Randy

Tags for this Thread

No tags are associated with this thread.

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.

Contact us