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
???
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
Hey guys. This is what I think it is. Hope I don't cause confusion:
I've plotted 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.
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:
That's the plot below and I used the following Mathematica code with the "Which" operator to plot it:
Now the Fourier series for the function is easy to calculate: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}]
Let
and:
with:
And if Captain Black reprimands me again for getting it wrong it's your fault.
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}]