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 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.

Comments and Ratings (18)

This site is so much helpful for researchers.


polar (view profile)

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


polar (view profile)

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


puqiao (view profile)

sinlin ray


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!


Chet (view profile)

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???


Chet (view profile)

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.


Taiwo (view profile)

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


Updated license

Minor edit. Added MAT-file. No change to code.

Added link to recorded webinar

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

Inspired by: Intelligent Dynamic Date Ticks

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video