T = linspace(0,1,100); %100 equally spaced points in [0,1]
plot(T, sin(2*pi* T)); % sin "wraps" around the vector T
ylim([-1.2 1.2]); % Give the plots a little more room
figure % start a new figure
hold on % put all plots on the same figure
%Plot the fundamental harmonics of sine on [0,1]
for k = 1:5
plot(T, sin(2 + pi * k * T));
ylim([-1.2 1.2]);
end
hold off
%compute and plot the partial sums of 1/j^2
N = 100;
app = zeros(1, 100); % preallocate some space for the vector app
app(1) = 1;
for j = 1:(N-1)
app(j+1) = app(j) + 1/(j+1)^2;
end
figure % start a new figure
plot(1:N, app);