Hierarchy in MATLAB

Introduction to Hierarchy

This blog is part 2 on the object oriented programming in Matlab. Consider reading out previous blog first.

In classifying objects, hierarchy in the objects is a common occurrence, where subclasses and super-classes can be defined. In the example of a rectangle class, a superclass namely Shape can be defined, where the superclass provides a more broadly defined class for a shape, and rectangle a more narrowly defined class for a specific type of shape. We can extend our example, by including the creation of Triangle and Circle classes, which are also subclasses of the superclass Shape.

Continue reading

Demo: How to create objects using OOP in MATLAB in under 10 minutes!


In this post, a demonstration on how to create objects using object oriented programming (OOP) in MATLAB is covered using easy to follow steps, and the basic MATLAB syntax. The demo is structured as follows:

  • creating objects using the basic MATLAB syntax,
  • hierarchy in objects (including Abstract method functions), and
  • initialising and validating property values.

OOP is an approach to programming, where focus is put on design patterns and classification systems. It forms a consistent framework which is recognisable, and can be easily reused and extended by others. OOP is ideal to use when designing complex models, because of the flexibility and extensibility of the code, where a simple model can easily be extended to cover a more complex model. Continue reading


We are looking at Octave as an alternative or extension to Matlab. Octave has the major advantage of being open source allowing you to share your code with ease and no additional cost. Anybody interested in your code can simply download and install Octave and start executing and editing the code. Matlab code can also be shared, but a license fee is charged for each Matlab installation. Depending on your target audience this might significantly reduce your reach.

For those of you unfamiliar with Octave:

GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. Octave is normally used through its interactive command line interface, but it can also be used to write non-interactive programs. The Octave language is quite similar to Matlab so that most programs are easily portable.

GNU Octave

We will be blogging about experiences to help others in their considerations of Octave and in the hope to gather feedback from the financial engineering community.

Matlab Validation at Kempen & Co.

In collaboration with Valu8, we acted for Kempen & Co in validating the valuation and hedging of the Inflation Breaker, a portfolio of ground lease contracts.

The contracts in the portfolio generate monthly cash flows based on the rent. Rents increase annually, with the Dutch pricing inflation index. At maturity of the contract, the tenant has the option, but not the obligation, to buy back the land.

This was not the first time Kempen & Co decided to entrust this validation to Valu8 and Ugly Duckling. This shows that Ugly Duckling is a key player in software, management and finance with an integrated approach that delivers. The work done was a continuation of previous validation work where we checked the cash flow model, the interest rate curve construction methodology and the inflation model. The previous implementation was improved and migrated to Matlab (previously Excel/VBA), which required a new validation.