# Fourier Series help

• Oct 17th 2008, 05:43 PM
hashi
Fourier Series help
Hi,

Need help with the following question:

f(t) = t - 1, 1<t<2
with an even half range expansion, and f(t)=f(t+4)

Now, I have to sketch this between -6 and 6. Is an "even extension" the same as "even half range expansion"?
If I am to sketch this would it be
a t-1 line from 1<t<2 and 4<t<5
a -t-1 line from -1<t<-2 and -4<t<-5
and 0 elsewhere in -6<t<6
???
• Oct 18th 2008, 12:59 AM
CaptainBlack
Quote:

Originally Posted by hashi
Hi,

Need help with the following question:

f(t) = t - 1, 1<t<2
with an even half range expansion, and f(t)=f(t+4)

Now, I have to sketch this between -6 and 6. Is an "even extension" the same as "even half range expansion"?
If I am to sketch this would it be
a t-1 line from 1<t<2 and 4<t<5
a -t-1 line from -1<t<-2 and -4<t<-5
and 0 elsewhere in -6<t<6
???

As the function has period 4, it needs to be defined on a larger interval than (1,2), is it supposed to be zero on (0,1)??

CB
• Oct 18th 2008, 04:26 AM
hashi
nope.. it's supposed to be 1 to 2
• Oct 18th 2008, 07:40 AM
CaptainBlack
Quote:

Originally Posted by hashi
nope.. it's supposed to be 1 to 2

Then there is not enough information to do anything with a periodic function of period 4, the function needs to be defined over a whole period, which allowing for even symmetry still requires it be defined on an interval of length 2.

CB
• Oct 18th 2008, 05:00 PM
hashi
actually, yes i am pretty sure it's supposed to be zero elsewhere..
now what/
• Oct 18th 2008, 11:01 PM
CaptainBlack
Quote:

Originally Posted by hashi
actually, yes i am pretty sure it's supposed to be zero elsewhere..
now what/

OK so now we have the function:

$\displaystyle f(x)= \begin{cases} 0,\ \ \ \ \ \ \ 0\le x <1 \\ t-1,\ \ 1 \le x \le 2 \end{cases}$

Which we extend symmetricaly to the range $\displaystyle -2 \le x \le 2$, to get:

$\displaystyle f(x)= \begin{cases} -t-1, \ \ -2 \le x \le -1 \\ 0, \ \ \ \ \ \ \ \ \ -1 < x < 1 \\ t-1,\ \ \ \ \ \ \ 1 \le x \le 2 \end{cases}$

CB
• Oct 19th 2008, 03:24 AM
hashi
Sorry, how did you get f(x) = 1 between 1 and 2 when the function is
f(t)=t-1?

Also, since we are sketching over a domain -6<t<6 would it be...
Now, I have to sketch this between -6 and 6. Is an "even extension" the same as "even half range expansion"?
If I am to sketch this would it be
a t-1 line from 1<t<2 and 4<t<5
a -t-1 line from -1<t<-2 and -4<t<-5
and 0 elsewhere in -6<t<6
???
(what i said before?)

thanks
• Oct 19th 2008, 04:49 AM
shawsend
Hey guys. This is what I think it is. Hope I don't cause confusion:

$\displaystyle f(x)=\left\{\begin{array}{cc} -t-5 & -6\leq t \leq -5 \\ -t-1 & -2\leq t\leq -1 \\ t-1 & 1\leq t\leq 2 \\ t-5 & 5\leq t \leq 6 \\ 0 & \text{otherwise} \end{array}\right.$

I've plotted $\displaystyle f(x)$ and the first 50 terms of it's Fourier series superimposed over it in the plot below. If that's the function you're working with and need help figuring it's Fourier series, I can post my calculations.
• Oct 19th 2008, 10:18 AM
CaptainBlack
Quote:

Originally Posted by hashi
Sorry, how did you get f(x) = 1 between 1 and 2 when the function is
f(t)=t-1?

Also, since we are sketching over a domain -6<t<6 would it be...
Now, I have to sketch this between -6 and 6. Is an "even extension" the same as "even half range expansion"?
If I am to sketch this would it be
a t-1 line from 1<t<2 and 4<t<5
a -t-1 line from -1<t<-2 and -4<t<-5
and 0 elsewhere in -6<t<6
???
(what i said before?)

thanks

by misremembering what the function was (since I was not looking at it at the time) fixed now.

CB
• Oct 19th 2008, 10:29 AM
CaptainBlack
Quote:

Originally Posted by shawsend
Hey guys. This is what I think it is. Hope I don't cause confusion:

$\displaystyle f(x)=\left\{\begin{array}{cc} -t-5 & -6\leq t \leq -5 \\ -t-1 & -2\leq t\leq -1 \\ t-1 & 1\leq t\leq 2 \\ t-5 & 5\leq t \leq 6 \\ 0 & \text{otherwise} \end{array}\right.$

I've plotted $\displaystyle f(x)$ and the first 50 terms of it's Fourier series superimposed over it in the plot below. If that's the function you're working with and need help figuring it's Fourier series, I can post my calculations.

Your diagram does not show a function with period 4.

CB
• Oct 19th 2008, 10:31 AM
CaptainBlack
Quote:

Originally Posted by hashi
Sorry, how did you get f(x) = 1 between 1 and 2 when the function is
f(t)=t-1?

Also, since we are sketching over a domain -6<t<6 would it be...
Now, I have to sketch this between -6 and 6. Is an "even extension" the same as "even half range expansion"?
If I am to sketch this would it be
a t-1 line from 1<t<2 and 4<t<5
a -t-1 line from -1<t<-2 and -4<t<-5
and 0 elsewhere in -6<t<6
???
(what i said before?)

thanks

Remember we have an even period 4 function so the plot outside the fundmental period is obtained by a periodic extension.

CB
• Oct 20th 2008, 12:33 AM
hashi
hey shawsend.. how do you just plot f(x) and it's even half range expansion?

Thanks
• Oct 20th 2008, 04:38 AM
shawsend
Well, I wasn't planning on saying anything further since I got it wrong above and I'm not familiar with the phrase "even half extension", but since you asked, I think it's the function:

$\displaystyle f(x)=\left\{\begin{array}{cc} -t-5 & -6\leq t \leq -5 \\ t+3 & -3\leq t\leq -2 \\ -t-1 & -2\leq t\leq -1 \\ t-1 & 1\leq t\leq 2 \\ -t+3 & 2\leq t \leq 3 \\ t-5 & 5\leq t \leq 6 \\ 0 & \text{otherwise} \end{array}\right.$

That's the plot below and I used the following Mathematica code with the "Which" operator to plot it:

Code:

f[t_] := Which[-6 <= t <= -5, -t - 5, -3 <= t <= -2, t + 3,     -2 <= t <= -1, -t - 1, 1 <= t <= 2, t - 1, 2 <= t <= 3, -t + 3,     5 <= t <= 6, t - 5]; Plot[f[x], {x, -6, 6}]
Now the Fourier series for the function is easy to calculate:

Let $\displaystyle T=\text{Abs}(-6-6), \omega_n=\frac{2\pi n}{T}$

and:

$\displaystyle \text{F.S}\; f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos(\ome ga t)+b_n\sin(\omega t)$

with:

$\displaystyle a_n=\frac{2}{T}\int_{-6}^{6} f(t)\cos(\omega_n t)dt$

$\displaystyle b_n=\frac{2}{T}\int_{-6}^{6} f(t)\sin(\omega_n t)dt$

And if Captain Black reprimands me again for getting it wrong it's your fault.(Thinking)
• Oct 27th 2008, 07:53 AM
mslodyczka
shawsend, I have a similar problem to the one the OP has. Can you explain how to get a plot of the fourier approx in matlab?

anyone?
• Oct 27th 2008, 10:51 AM
shawsend
I don't use Matlab. But the principle is the same: calculate the coefficients, say 25 or so, put them all together in the Fourier sum as a function, then plot the results. The following is my Mathematica code. You can probably easily convert it to Matlab code assuming Matlab can handle the conditional function definition.

Code:

f[t_] := Which[-6 <= t <= -5, -t - 5, -3 <= t <= -2, t + 3,     -2 <= t <= -1, -t - 1, 1 <= t <= 2, t - 1, 2 <= t <= 3,     -t + 3, 5 <= t <= 6, t - 5, -5 <= t <= -3, 0, -1 <= t <= 1,     0, 3 <= t <= 5, 0]; fplot = Plot[f[x], {x, -6, 6}]; a0 = NIntegrate[f[t], {t, -6, 6}]; a = Table[(1/6)*NIntegrate[f[t]*Cos[((Pi*n)/6)*t], {t, -6, 6}],     {n, 1, 25}]; b = Table[(1/6)*NIntegrate[f[t]*Sin[((Pi*n)/6)*t], {t, -6, 6}],     {n, 1, 25}]; fs[x_] := N[a0/12 + Sum[a[[n]]*Cos[Pi*(n/6)*x] +       b[[n]]*Sin[Pi*(n/6)*x], {n, 1, 25}]]; fsplot = Plot[fs[x], {x, -6, 6}, PlotStyle -> Red]; Show[{fplot, fsplot}]