Schottky barrier formation at metal electrodes and semiconducting carbon nanotubes