% Solves u_xx = f with zero boundary conditions

clear;  %  gets rid of old data

L = 10;  % domain size
N = 100; % number of interior spatial mesh points (note # intervals = N+1)
dx = L/(N+1);

%setup grid

x = [dx: dx: L-dx]';   % x is the column vector x_1, ..., x_N
                       % the ' denotes a matrix transpose

% setup initial data:  u is a N-1 size column vector which
% will always contain the solution at the present time step

f = sin(5*pi*x/L);

% A will be a NxN matrix
% recall that the command "diag(ones(N-abs(k)),k)" constructs a matrix
% with ones on the kth diagonal (k=0 is the central one)

A = ;   %You get to fill this in

u = A\f;  % solves linear equation Au = f

plot(x,u,'.');  %plot with dots instead of a line

%now plot exact solution
exact = -(5*pi/L)^(-2)*f;
hold on;  % this keeps the previous plot
plot(x,exact);  %plot as a contiuous line
hold off;