A mathematical framework for the analysis and modelling of memristor nanodevices