function K=Rigidite(x)
  nq=length(x);nme=nq-1;
  h=x(2:nq)-x(1:(nq-1));
  K=sparse(nq,nq);
  for k=1:nme
    I=k:k+1;
    Mk=RigiditeElem(h(k));
    K(I,I)=K(I,I)+Mk;
  end  
end

function Me=RigiditeElem(hk)
  Me=(1/hk)*[1, -1; -1,1];
end
