just for some quick clarification, do you want the fourier series (which implies the pattern repeats) or the fourier integral (a single pulse) ?
General form of a fourier series:
Remember, 2L = length of the period, so L is half the length of the period.
Those n's are your series. Start with 0, then do 1, then -1, then 2, then -2, etc. You could do any order you want really... try it out to fit your convergence problem.
Note that the two f(x) are technically the same, but treated differently. You use your piecewise defined function to get the cn's. Then you use the cn's to get your series (the f(x) in the top equation).
You first solve for the cn's using a piecewise defined function. In your case, you'll split the integral in two:
These can be incredibly tedious, so I suggest using mathematica or something
i'll explain it more carefully. you see how we started with a piecewise defined function:
f(x) = -pi/4 -pi < x < 0
pi/4 0 < x < pi
Okay, you use this function to find your cn values. I'll do n = 0, n = 1, and n = -1:
= 0
= -i/2
= i/2
So the first few terms in your series are:
0 + (-i/2)*e^(ix) + (i/2)*e^(-ix)
If you plot y = (-i/2)*e^(ix) + (i/2)*e^(-ix)
you'll already see a periodic function, but it needs a lot more terms to look good. You'll find that all the terms with n even are zero, this is because its an odd function and this is expected.
You can get mathematica to give you all the terms you want:
Sum[E^(I*n*x)*((1/(2*Pi))*
Integrate[(Pi/4)*E^(-I*n*y), {y, 0, Pi}] + (1/(2*Pi))*
Integrate[(-Pi/4)*E^(-I*n*y), {y, -Pi, 0}]), {n, -20, 20, 1}]
This will spit out all the terms from n = -20 to 20
No you dont have to use mathematica, its just easier. If you plug in that sum that I talked about, you'll get:
(I/2)/E^(I*x) - (I/2)*E^(I*x) + (I/6)/E^((3*I)*x) - (I/6)*E^((3*I)*x) +
(I/10)/E^((5*I)*x) - (I/10)*E^((5*I)*x) + (I/14)/E^((7*I)*x) -
(I/14)*E^((7*I)*x) + (I/18)/E^((9*I)*x) - (I/18)*E^((9*I)*x) +
(I/22)/E^((11*I)*x) - (I/22)*E^((11*I)*x) + (I/26)/E^((13*I)*x) -
(I/26)*E^((13*I)*x) + (I/30)/E^((15*I)*x) - (I/30)*E^((15*I)*x) +
(I/34)/E^((17*I)*x) - (I/34)*E^((17*I)*x) + (I/38)/E^((19*I)*x) -
(I/38)*E^((19*I)*x)
Notice that f(Pi/2) = Pi/4 by your piecewise defined function at the beginning.
Check out what happens if you plug Pi/2 in for x in the above equation, you'll get:
(I/2)/E^(I*x) - (I/2)*E^(I*x) = 1
(I/6)/E^((3*I)*x) - (I/6)*E^((3*I)*x) = -1/3
(I/10)/E^((5*I)*x) - (I/10)*E^((5*I)*x) = 1/5
(I/14)/E^((7*I)*x) - (I/14)*E^((7*I)*x) = -1/7
etc...
Notice also: I gave the general complex form of the fourier series. Your particular function is odd so you can just use a sine series. Its probably much easier to do so actually. Look into it.