Skip to main content
deleted 20 characters in body
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

I'd like to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

 s[n_, x_] :=  8/4 + 3/(9 \[Pi]π) Sum[(6 (-1)^k)/(k \[Pi]π) 
                Cos[(k \[Pi]π x)/2] + (16 (-1)^k + 13)/(\[Pi]π k) 
                Sin[(k \[Pi]π x)/2],{k, 0, n}]

 partialsums = Table[s[n, x], {n, 1, 5}];

 f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]

 Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas about the best method to tackle something like this?

I'd like to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

 s[n_, x_] :=  8/4 + 3/(9 \[Pi]) Sum[(6 (-1)^k)/(k \[Pi]) 
                Cos[(k \[Pi] x)/2] + (16 (-1)^k + 13)/(\[Pi] k) 
                Sin[(k \[Pi] x)/2],{k, 0, n}]

 partialsums = Table[s[n, x], {n, 1, 5}];

 f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]

 Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas about the best method to tackle something like this?

I'd like to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

 s[n_, x_] :=  8/4 + 3/(9 π) Sum[(6 (-1)^k)/(k π) 
                Cos[(k π x)/2] + (16 (-1)^k + 13)/(π k) 
                Sin[(k π x)/2],{k, 0, n}]

 partialsums = Table[s[n, x], {n, 1, 5}];

 f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]

 Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas about the best method to tackle something like this?

Tweeted twitter.com/#!/StackMma/status/175732950367862785
deleted 6 characters in body
Source Link
Sjoerd C. de Vries
  • 66.1k
  • 15
  • 189
  • 327

I am wantingI'd like to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

s[n_, x_] :=  8/4 + 3/(9 \[Pi]) Sum[(6 (-1)^k)/(k \[Pi]) 
 s[n_, x_] :=  8/4 + 3/(9 \[Pi]) Sum[(6 (-1)^k)/(k \[Pi]) 
                Cos[(k \[Pi] x)/2] + (16 (-1)^k + 13)/(\[Pi] k) 
                Sin[(k \[Pi] x)/2],{k, 0, n}]

 partialsums = Table[s[n, x], {n, 1, 5}];

 f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}] 

 Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]
partialsums = Table[s[n, x], {n, 1, 5}];
f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]
Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas ofabout the best method to tackle something like this.?

I am wanting to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

s[n_, x_] :=  8/4 + 3/(9 \[Pi]) Sum[(6 (-1)^k)/(k \[Pi]) 
                Cos[(k \[Pi] x)/2] + (16 (-1)^k + 13)/(\[Pi] k) 
                Sin[(k \[Pi] x)/2],{k, 0, n}]
partialsums = Table[s[n, x], {n, 1, 5}];
f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]
Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas of the best method to tackle something like this.

I'd like to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

 s[n_, x_] :=  8/4 + 3/(9 \[Pi]) Sum[(6 (-1)^k)/(k \[Pi]) 
                Cos[(k \[Pi] x)/2] + (16 (-1)^k + 13)/(\[Pi] k) 
                Sin[(k \[Pi] x)/2],{k, 0, n}]

 partialsums = Table[s[n, x], {n, 1, 5}];

 f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}] 

 Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas about the best method to tackle something like this?

Source Link
night owl
  • 1.7k
  • 3
  • 15
  • 27

Plotting Partial Sums of Fourier Series

I am wanting to plot some partial sums for a Fourier Series problem, but I am not sure if the output I am getting is correct. I want to be able to plot the partial sums and the function on the same graph. Here is something that I attempted.

s[n_, x_] :=  8/4 + 3/(9 \[Pi]) Sum[(6 (-1)^k)/(k \[Pi]) 
                Cos[(k \[Pi] x)/2] + (16 (-1)^k + 13)/(\[Pi] k) 
                Sin[(k \[Pi] x)/2],{k, 0, n}]
partialsums = Table[s[n, x], {n, 1, 5}];
f[x_] = Piecewise[{{-x^3-2x,-2 < x < 0},{-1+x,0<= x <= 2}}]
Plot[Evaluate[partialsums], {x, -4 Pi, 4 Pi}]

Any ideas of the best method to tackle something like this.