Battery Modeling

Lithium ion battery characterization, state estimation, cell balancing, and thermal management
Updated 3 Jun 2021

View License

Editor's Note: Popular File 2020

This file contains Simscape Electrical Lithium-ion battery models for parameter estimation and simulation.
1. Unzip the project.
2. Double-click BatteryModeling.prj to set up the MATLAB path. The html index contains links to open each example.
1. 3S-1P battery pack CCCV charge with passive balancing using Simscape Electrical. Charge / discharge cycling with passive balancing, including thermal effects.
2. EV battery cooling. Liquid cooling of an automotive battery pack.
3. Cell characterization. Parameter estimation of single cell using pulsed discharge experiments.
4. SOC Estimation using UKF.
5. SOH (internal resistance) online estimation using EKF. Internal resistance grows over time and the nonlinear Kalman Filter estimates its evolution.
6. Battery App. This app can be used to find battery parameters from datasheet information.
This site contains additional information on battery modeling using MathWorks(R) tools:
Additional literature:
SAE 2015: Model-Based Parameter Identification of Healthy and Aged Li-ion Batteries for Electric Vehicle Applications
Webinar: Battery Data Acquisition and Analysis Using MATLAB
Webinar: Lithium Battery Model with Thermal Effects for System-Level Analysis
IEEE 2012: Lithium Battery Model with Thermal Effect
SAE 2013: Simplified Extended Kalman Filter Observer for Battery SOC Estimation
SAE 2013: Battery Model Parameter Estimation Using a Layered Technique
SAE 2014: Battery Pack Modeling, Simulation, and Deployment on a Multicore Real Time Target
Webinar: Optimizing Vehicle Electrical Design through System-Level Simulation
Video: Real-Time Simulation of Battery Packs Using Multicore Computers
Video: MATLAB & Simulink Racing Lounge: Battery Modeling with Simulink
Using Model-Based Design to Build the Tesla Roadster
MathWorks(R) Consulting offers services on this topic. For assistance, please contact me or your MathWorks(R) representative.

Cite As

Javier Gazzarri (2024). Battery Modeling (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with R2019a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!







Version Published Release Notes

Updated description with mention of the tools needed for physical modeling


Demos use new battery cell block


This version uses the new battery cell block and incorporates new SOC and SOH workflows

Fixed incompatibilities with new Simscape(TM) unit system

Updated license

Updated link to: SAE 2014: Battery Pack Modeling, Simulation, and Deployment on a Multicore Real Time Target
updated a hyperlink in description
added link to new paper on lithium battery cell parameter changes due to aging

updated links in description only

Corrected webinar links

Added acknowledgement for other entry - electrical system simulation

Description updated - added a link to the Battery Data Acquisition webinar. No changes to the files.

Updated description only. No file changes.

Added a new webinar link to the description

Updated a bad link to the parameter estimation video.

Fixed an issue with temperature units on R2012b demos.

Modified description only to add links to new publications.

Updated the R2012b+ version of the models:
1. The shortcut block to open the custom library was broken
2. Use Kelvin temperature units within the Simscape model

There is a known bug in R2013a. Please see README.txt for info.

R2012b folder with .SLX file format. Excluded R2012b +LiBatteryElements folder because it is a shipping demo.

ssc_lithium_cell_SDO_Project.mat parallel computing unchecked as default, due to a bug if the toolbox is not installed. See Readme.txt

Added 80-cell battery pack model.

Added link to demo video. Removed extraneous Simscape mex files. (Note: you will need to run "ssc_build LiBatteryElements" to build a machine-specific Simscape library for the battery building blocks.

Updated copyright statement, link to webinar.