Uploaded July 2025 | Updated September 2026, 2 weeks ago
Creating an animation using a for loop in a live script? You can review the animation after running the script and directly export as a video or animated GIF.
--------------------------------------------------------------------------------------------------------
Get a free product trial: goo.gl/ZHFb5u
Learn more about MATLAB: goo.gl/8QV7ZZ
Learn more about Simulink: goo.gl/nqnbLe
See what's new in MATLAB and Simulink: goo.gl/pgGtod
© 2025 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc.
See mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
Creating an animation using a for loop in a live script? You can review the animation after running the script and directly export as a video or animated GIF.
--------------------------------------------------------------------------------------------------------
Get a free product trial: goo.gl/ZHFb5u
Learn more about MATLAB: goo.gl/8QV7ZZ
Learn more about Simulink: goo.gl/nqnbLe
See what's new in MATLAB and Simulink: goo.gl/pgGtod
© 2025 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc.
See mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.







![Developing and Embedding AI-Based SOC Estimation for BMS Using MATLAB
Learn how MATLAB® that can be used to develop and compress an AI model for battery state-of-charge (SOC) estimation, then deploy it to a microcontroller for real-time use in a battery management system (BMS).
With a single line of MATLAB code, you can generate standalone, generic C or C++ code for deep learning models created in MATLAB or imported from other frameworks. Begin by constructing and training a long short-term memory (LSTM) deep learning network for battery SOC prediction using the Deep Network Designer app in MATLAB. Then, apply neural network projection to compress the network by over 90%, optimizing it for efficient execution on a resource-constrained microcontroller. Finally, generate generic C code for the compressed LSTM model using the MATLAB Coder™ app. Once code generation is complete, the generated C code can be integrated with the remaining BMS firmware to predict SOC in real time.
The data set used for battery SOC estimation in this example can be found in [1]:
[1] Eleftheriadis, Panagiotis. “PoliMi-TUB Dataset - LG 18650HE4 Li-Ion Battery.” Mendeley Data, V1, 2024. http://bit.ly/3HOQLSf
Learn more:
- MATLAB and Simulink for Embedded AI: https://bit.ly/4g21mIh
- Compressing Neural Networks for Embedded AI: https://youtu.be/7uV3-eTB5es
- A Practical Introduction to Edge AI: https://youtu.be/ibm6ZRi6Sm4
Get a free product trial: https://goo.gl/ZHFb5u
Learn more about MATLAB: https://goo.gl/8QV7ZZ
Learn more about Simulink: https://goo.gl/nqnbLe
See whats new in MATLAB and Simulink: https://goo.gl/pgGtod
© 2025 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc.
See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Developing and Embedding AI-Based SOC Estimation for BMS Using MATLAB](https://i.ytimg.com/vi/tJZ_sr4jlWU/mqdefault.jpg)


