Shorter program for staircase curve from Fourier series

Mathematica 8


NN = 12;
xmax = 35;
a = Table[
Sum[(Cos[x*(k)/NN*2*Pi] + Cos[x*(k - 1)/NN*2*Pi])/2, {k, 1,
NN}], {x, 0, xmax, 0.1}];
N[Max[a], 40]
ListLinePlot[a, PlotRange -> {-4, NN + 1/2}]
ListLinePlot[Accumulate[a]]

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.