function HW6

n_elements = 3;
n_nodes = n_elements+1;
T = 100;
L = 1;
q0 = 1;
K = zeros(n_nodes);
for i=2:n_nodes-1
    K(i,i) = 6*T/L;
    K(i,i-1) = -3;
    K(i,i+1) = -3;
    r(i) = q0*L/6;
    x(i) = (i-1)*L/(n_nodes-1)
end
x(1) = 0;
x(n_nodes) = L;
r(1) = 0;
r(n_nodes) = 0;
K(1,1) = 1;
K(n_nodes,n_nodes) = 1;
    

u = K\r;

plot(x,u)





end