# Fourier Series (Given Period)

Discussion in 'Math' started by naickej4, Jul 1, 2016.

1. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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.

thank you all.

File size:
85.9 KB
Views:
11
2. ### WBahn Moderator

Mar 31, 2012
22,741
6,773
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.

3. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
Hi Sir, thanks.

Must I sketch the initial piecewise function?

thank you.

4. ### WBahn Moderator

Mar 31, 2012
22,741
6,773
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.

5. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073

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: Jul 2, 2016
6. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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

7. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
Hi Mr AI and WBahn, I have attempted this question again. Please can you find my attached answer and let me know if I my solution is correct or on the right track.

thank you

• ###### Fourier Series (Given Period) Answer.pdf
File size:
104.1 KB
Views:
4
josh007 likes this.
8. ### josh007 Member

Sep 20, 2015
43
1
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.

regards
Joshy

9. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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

10. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073
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

11. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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.

12. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073
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.

13. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073
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.

File size:
19.5 KB
Views:
3
14. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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.

15. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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

thank you all for the advice and input.

16. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073
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?

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

Last edited: Jul 15, 2016
17. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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.

18. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073
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.

19. ### MrAl Distinguished Member

Jun 17, 2014
4,991
1,073
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.

20. ### naickej4 Thread Starter Member

Jul 12, 2015
206
10
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.