k(1)=1.5;
k(2)=1;
k(3)=1.5;
k(4)=2;
l(1)=0.3;
l(2)=0.1;
l(3)=0.2;
l(4)=0.2;
b=zeros(4,1);
for i=1:3
   b(i)=k(i)*l(i)-k(i+1)*l(i+1);
end
b(4)=1;
m=zeros(4,4);
for i=1:3
   m(i,i)=k(i)+k(i+1);
   m(i+1,i)=-k(i+1);
   m(i,i+1)=-k(i+1);
end
m(4,4)=1;
m(4,3)=0;
b
m
x=m\b
