% change these to whichever you like
t = [0 0.01 0.1 0.3]
Nupper = 15

x = 0:0.01:1;
for tt = t
    u = zeros(size(x));
    for n = 1:2:Nupper
        %% choose one of the next two lines
        %An = 4/(pi*n);  % phi(x) = 1; Lesson 5 exercises 3,4
        An = 8*(pi*n)^(-3);  % phi(x) = x-x^2; Lesson 5 exercises 6
        u = u + An * exp(- (n*pi)^2 * tt) * sin(n*pi * x);
    end
    plot(x,u), hold on
end
hold off, xlabel x, ylabel u