File Exchange

image thumbnail

Energy Trading & Risk Management with MATLAB Webinar Case Study

version (3.07 MB) by Siddharth Sundar
MATLAB code for the generation asset risk analysis case study


Updated 01 Sep 2016

View Version History

View License

The case study presented here demonstrates using MATLAB to build an application for measuring the risks associated with a portfolio of gas-fired power plants operated in New England. The application has an interface implemented in Excel with all of the analytics performed by MATLAB. The application allows the user to specify the characteristics of the 7 plants including the capacity, heat rate, variable operation and maintenance costs and minimum run time. This portfolio can be backtested using a simple dispatch strategy on historical gas and electricity prices to compute historical profit and plant operation statistics. The risk measures are computed by simulating gas and electricity prices into the future using a hybrid model implemented in MATLAB, simulating the dispatch for each scenario of market prices and computing cash-flows arising from the operation of the plants. The distribution of the cash-flows is analyzed to produce a 90% and 95% cash-flow at risk measure for each plant as well as for the portfolio of generation assets. All of this functionality is presented with a succinct Excel front end.

The document titled "Introduction to ETRM Case Study" will guide you through the different components of the analysis.

Note: The data used in this application is not provided with the MATLAB Central File Exchange entry. The data can be obtained from the New England ISO at The Natural Gas spot price data can be obtained from the Wall Street Journal at You can still view the results of running each script on the data by viewing the MATLAB-published reports included in the archive and also linked below.

Cite As

Siddharth Sundar (2021). Energy Trading & Risk Management with MATLAB Webinar Case Study (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (24)

JINTI zhang

Chet Sharma

Andleeb Akram

ding wei

Tommaso Belluzzo

Abderrahim Bakir

Can any one help me please! I can't find the Natural Gas spot price data from the Wall Street Journal at, please any ideas how can I find it.

Utpal Kumar Das

This site is so much helpful for researchers.


Ok, I finally managed to run the .m codes
Everything but one:"ModellNGPrice.m" which retruns me this error:

"Undefined variable "data" or function "data.NaturalGas".

Error in ModelNGPrice (line 19)
S = data.NaturalGas;

As I can understand it's due to the lack of the database create by using the visual database query" (as in the webinar video). How can i solve this problem? Thanks


I followed the instruction reported on the word file but I can't find the "energy.accdb" file.
I can't run the codes without it. Could, please someone help me? thanks

Yoga Rajan


sinlin ray

Szilárd Németh


Ruhi Gupta

Thanks Chetan for the info...
But i managed to run it without the file; i guess, the saved models are sufficient to get things done, but i'll surely try to get the accdb file also, if possible...

anyway, thanks again!


Hi Ruhi, you'll get it if you attend the actual seminar. Or you could contact Matlab directly, I'm sure they'll send it over to you.

Ruhi Gupta

@Chetan, from whr did u get the energy.accdb file???


I tried to open the energy.accdb in matlab and it asks me for a login. Does anyone have it?

Laszlo Siller

I think this is a very good seminar,

Could somebody help me with the following error , ModelNGPrice.m ;

sata =

NaturalGas: [2676x1 double]
Info: [1x1 struct]
Date: [2676x1 double]

??? Undefined function or variable 'data'.

Error in ==> ModelNGPrice at 19
S = data.NaturalGas;

Thank you


I think this is a very good seminar, however I'm not able to find the data of the database on the websites amd
Could you kindly advise me how can I get energy.accdb file? or could you please give me the matlab workspace with all the data?
Thank you very much

king regards


I think this is a very good seminar, however I'm not able to find the data of the database on the website
Could you kindly advise me how can I get energy.accdb file?

An excellent webinar. I've learnt a lot within less than an hour. At the same time, I'm afraid - MATLAB is moving so fast that throws extra challenges to a novice researcher like me.


This is top class webinar. How can i have a Powerpoint presentation of this as i need to listen to this over and over again...

Andres Licona

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Intelligent Dynamic Date Ticks

Community Treasure Hunt

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

Start Hunting!