Model of resistive switching in a nonuniformly strained carbon nanotube