function [app,M] = Fig2x4(t,N)
% Approximating t on [-pi,pi]
% Initialize with a0/2.... note that a0 = 0;
app = zeros(size(t));
% Add consecutive terms
for k = 1:N
app = app + 2/k*(-1)^(k+1)*sin(k*t);
plot(t,t,t,app,t,zeros(size(t)),'k');
H = gcf;
M(k) = getframe(H);
end
% M is a movie of the results