Fourier Series (Given Period)

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hello All,
Please can you help me with the below past year exam question. I attempted and tried to find the Coefficients but I am still getting confused when making up the entire series in the end. I even read the past threads and the article on fourier Coefficients on this site, very helpful summary.
http://www.allaboutcircuits.com/technical-articles/the-fourier-coefficients/

Also please can you check if my answers are correct.
thank you all.

upload_2016-7-1_7-35-40.png
 

Attachments

WBahn

Joined Mar 31, 2012
32,872
You can either work from the definition directly, or you could write x(t) as the sum of functions that you already know the coefficients for and then add them up.

Sketch the waveform and see if it isn't the obvious sum of two very simple waveforms.
 

Thread Starter

naickej4

Joined Jul 12, 2015
206
You can either work from the definition directly, or you could write x(t) as the sum of functions that you already know the coefficients for and then add them up.

Sketch the waveform and see if it isn't the obvious sum of two very simple waveforms.
Hi Sir, thanks.

Must I sketch the initial piecewise function?

thank you.
 

WBahn

Joined Mar 31, 2012
32,872
Hi Sir, thanks.

Must I sketch the initial piecewise function?

thank you.
You don't HAVE to, but it can sure be helpful, at least until you can examine the function definition and picture it in your mind or otherwise see how to pull it apart.
 

MrAl

Joined Jun 17, 2014
13,708
Hello All,
Please can you help me with the below past year exam question. I attempted and tried to find the Coefficients but I am still getting confused when making up the entire series in the end. I even read the past threads and the article on fourier Coefficients on this site, very helpful summary.
http://www.allaboutcircuits.com/technical-articles/the-fourier-coefficients/

Also please can you check if my answers are correct.
thank you all.

View attachment 108545

Hello there,

I would just like to add that the best way to test something like this is to use the inverse of the generator function, which in this case would be the function that reconstructs the original time function. This, graphed, would look something close to the original function but not exactly because we usually only use maybe only the first 5 to 15 terms in the series to get a pseudo graph of the original function.
As an example, you can find the series for a square wave on the web and see what the reconstructed graph looks like. It looks almost like a square wave but has lots of squiggles in it. If the series you obtained was incorrect though, usually it is off by a lot or else the amplitude is not right. Also, as you add more terms the waveform starts to look more and more exactly like the original time waveform, except for what appears to look like the Gibbs phenomenon at abrupt discontinuities.

This is a very good self-test for this and lots of other problems. Even for simple algorithms that we write that have a simple function like y=log(x) we can use the inverse (like e^y or 10^y) to test our original function. If we write both algorithms, we test them both at the same time. We must get back the same thing we started with.
For the series, you just have to find the function that reconstructs the time function and that is usually presented along with the function that finds the coefficients in most books or on the web. It's very informative to learn both transformations at the same time.
 
Last edited:

Thread Starter

naickej4

Joined Jul 12, 2015
206
Awesome I fully understand. Thanks Sir. I am going to redo this example and will post my answer. I think I know what i was doing wrong. I have to insert the coefficients that i worked out into the equation and input each value for n...eg n=1,2,3,4.....
Thanks
 

josh007

Joined Sep 20, 2015
43
Hola,

I looked at your answer, and it looks very neat and orderly which is a good start as my lecturer tells us at college. I am sure A0 is correct the first coefficient but not certain of the rest!
I am a first year student and will only be starting this topic next semester.
I hope the experts on this forum can help you with your answer like they always do.

regards
Joshy
 

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hola,

I looked at your answer, and it looks very neat and orderly which is a good start as my lecturer tells us at college. I am sure A0 is correct the first coefficient but not certain of the rest!
I am a first year student and will only be starting this topic next semester.
I hope the experts on this forum can help you with your answer like they always do.

regards
Joshy
Hi Josh007,
thanks for your help and compliments.
Yeh A0 is correct. I finally think I found the correct answer after much studying and determination.
I will scan and post my new answer so others can analyze my workings.
I discovered that EVEN functions will only have COS terms and ODD functions only SINE terms.
This time I am sure its correct.

thanks
 

MrAl

Joined Jun 17, 2014
13,708
Hello again,

I just realized that you may not have been given the inverse function yet, which is what you would use to check your result.

Can you find that, or would you like to see it here?

The idea is simple, the inverse of the inverse function is the original function back again.
So with f(x) the original function:
R(s)=F(f(x))
f(x)=Finv(R(s))
where Finv is the recovery function which uses the a's and b's found for the series. The result of doing that is the original f(x) back again.

The two applied as a pair is useful when evaluating filters for example where you want to find the time solution to the output of a filter and you dont want to have to transform the filter itself. It's the old long way of doing the time domain solution but nonetheless very interesting :)
 

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hello again,

I just realized that you may not have been given the inverse function yet, which is what you would use to check your result.

Can you find that, or would you like to see it here?

The idea is simple, the inverse of the inverse function is the original function back again.
So with f(x) the original function:
R(s)=F(f(x))
f(x)=Finv(R(s))
where Finv is the recovery function which uses the a's and b's found for the series. The result of doing that is the original f(x) back again.

The two applied as a pair is useful when evaluating filters for example where you want to find the time solution to the output of a filter and you dont want to have to transform the filter itself. It's the old long way of doing the time domain solution but nonetheless very interesting :)
Hi Sir, awesome stuff. I didn't know something like this was possible. Please can you show this to me, I will really benifit from knowing this for the future. Also can check my new answer that I will post later.
Thank you very much.
 

MrAl

Joined Jun 17, 2014
13,708
Hi again,

The regeneration formula is:
f(t)=A0+Σ An*cos(w*n*t)+Bn*sin(w*n*t)
The summation is from n=1 to n=infinity, but we can use something smaller for testing like n=11, or n=21, or something low like that. Doing that we dont get the exact function back, but if we graph it we get a function that looks much like the original just with more squiggles in it. We could do an example if you like.

So for testing your result of the series, you'll get the An and Bn and A0 from the integrals, then you just put them into that formula and you get another series that can be graphed just like any time series. You would run time from say 0 to some convenient value depending on what time function you started out with. Note in some cases the An or Bn will be zero, so you dont need that part in the summation because all those terms will be zero too then.
For example, if you start out with a square wave with frequency of 1Hz, then you might plot from t=0 to 5 to be able to observe the graph.
There are online graphing sites if you need one.
You can probably find a square wave example online, and you'll see the reconstructed wave looks like a square wave too, but has some squiggles and also what looks like "rabbit ears" (chuckle) but it will have a main form of a square wave. so you know you did it right.
 

MrAl

Joined Jun 17, 2014
13,708
Hello again,

Here is an example of a rectangular wave.
This wave has a period of 1 second, and it 'on' for 0.25 seconds and off for 0.75 seconds for each cycle, so it's a 25 percent duty cycle wave.
The top trace is the original wave, the bottom trace the reconstructed wave. The reconstructed wave has the general shape of the original except that it has squggles and "ears".

The number of harmonics used was 51, although there may be no even harmonics.
 

Attachments

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hello again,

Here is an example of a rectangular wave.
This wave has a period of 1 second, and it 'on' for 0.25 seconds and off for 0.75 seconds for each cycle, so it's a 25 percent duty cycle wave.
The top trace is the original wave, the bottom trace the reconstructed wave. The reconstructed wave has the general shape of the original except that it has squggles and "ears".

The number of harmonics used was 51, although there may be no even harmonics.
Hi Sir, oh I see now what you meant by in the previous relpy. I'm trying now the same question that I posted with the last formula that you suggested.
I started doing DTF. Circular correlation and convolution. I am understanding the purpose of fourier. Its very amazing how this simple signals can be recontructed using just Sine and Cos in the sequence.
AMAZING!
Thank you.
 

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hi All,

I finally worked out a answer after many failed attempts and it does match up to the theory of odd and even functions. When ODD only sine terms are in the final sequence. I am finally understanding this topic :)

Please find my answer:

upload_2016-7-15_9-10-59.png

thank you all for the advice and input.
 

MrAl

Joined Jun 17, 2014
13,708
Hi All,

I finally worked out a answer after many failed attempts and it does match up to the theory of odd and even functions. When ODD only sine terms are in the final sequence. I am finally understanding this topic :)

Please find my answer:

View attachment 109207

thank you all for the advice and input.
Hello again,

You are welcome :)

Very good work there, but i want to remind you that you should ALWAYS plot your solution :)

I have a very strong feeling that is not the wave you intended to recreate. That's because the coefficient 6/pi does not match the DC offset of 1/2 for a waveform that is probably supposed to be entirely above zero.

Here is a plot of your wave with T=1. Is this really what you intended?
WaveWithOffset-1.gif

If you draw a straight line through the 'squigglies' you get a square wave that alternates between -1 and 2 (or thereabouts).
 
Last edited:

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hello again,

You are welcome :)

Very good work there, but i want to remind you that you should ALWAYS plot your solution :)

I have a very strong feeling that is not the wave you intended to recreate. That's because the coefficient 6/pi does not match the DC offset of 1/2 for a waveform that is probably supposed to be entirely above zero.

Here is a plot of your wave with T=1. Is this really what you intended?
View attachment 109215

If you draw a straight line through the 'squigglies' you get a square wave that alternates between -1 and 2 (or thereabouts).
Hi Sir, wow.
thats what I think it should be because if I plot the initial piece-wise function i get the 2 and -1 one with a period of T which alternates at 1/2 The Period. If you used my final answer to plot this and you it produces 2 and -1 THEN I am sure its correct.
How did you plot this? What software did you use? Since I want to also be able to do this plot using my final answer.
Thank you Sir.
 

MrAl

Joined Jun 17, 2014
13,708
Hi Sir, wow.
thats what I think it should be because if I plot the initial piece-wise function i get the 2 and -1 one with a period of T which alternates at 1/2 The Period. If you used my final answer to plot this and you it produces 2 and -1 THEN I am sure its correct.
How did you plot this? What software did you use? Since I want to also be able to do this plot using my final answer.
Thank you Sir.
Hello again,

Oh ok no problem then as long as that was the original time signal you wanted to experiment with. Most people start out with a wave that is symmetrical about the x axis so it looked suspicious, and i trust that you are telling me the truth too :)

I just use my own software, but let me get you something off the web.
Here is one: https://www.desmos.com/calculator
If you study the Windows API you can learn to make programs that graph too. It takes a while to learn though.

I am sure there are others too, or download a graphing calculator.
 

MrAl

Joined Jun 17, 2014
13,708
Hello again,

Here is a graph of the same function using harmonics up to the 51st.
Note the squigglies got much smaller, but the "ears" stay there pretty much although they get skinnier.
Wave_51st_Harmonic-1.gif
 

Thread Starter

naickej4

Joined Jul 12, 2015
206
Hi Sir, wow that looks over awesome. Thanks a stack. It looks almost like the original signal that i had to plot.
Great stuff.
So now I'm 100% sure my answer is correct.
So in a nutshell fourier series and transforms just converts the original function to a series containing sine and cosine functions?
I'm really amazed at this, being able to plot the graph and look like the original signal. Truly Maths is Amazing :)
Thank you.
 
Top