1. A memristor, comprising: a stack of four functional elements including, in sequence: a first electrode; a barrier layer; a TiO 2-x switching layer, where 0.023<x<0.030; and a second electrode, wherein the TiO 2-x switching layer is disposed between the barrier layer and the second electrode without any intervening layers.