Analysis of Lithium ion batteries