Monday, January 4, 2010

Using Matrices Functions for Finance

Many financial analysis procedures involve sets of numbers;.Matrices, matrix functions, and matrix algebra are the most efficient ways to analyze sets of numbers and their relationships. A matrix-oriented tool like MATLAB software manipulates sets of numbers more quickly, easily, and naturally.
For example, here is a 2-by-3 matrix of two bonds (the rows) with different par values, coupon rates, and coupon payment frequencies per year (the columns) entered using MATLAB notation:

Bonds = [ 1000    0.06  2

                     500  0.055  4 ]


Cash = [ 1500  4470  5280  -1299 ]


Referencing Matrix Elements

To reference specific matrix elements, use (row, column) notation. For example:

Bonds(1,2)

ans =

0.06

Cash(3)

ans =

5280.00

You can enlarge matrices using small matrices or vectors as elements. For example,

AddBond = [ 1000   0.065   2 ];
Bonds = [ Bonds;  AddBond ]

Adds another row to the matrix and creates

Bonds =


1000     0.06  2
  500   0.055  4
1000   0.065  2



Transposing Matrices

Sometimes matrices are in the wrong configuration for an operation. In MATLAB, the apostrophe or prime character (') transposes a matrix: columns become rows, rows become columns. For example,

Cash = [ 1500 4470 5280 -1299 ]'

produces

Cash =

  1500
 4470
 5280
-1299

It's interesting to see matrices being used in this line of work.
More information can be found at this site

Richard Khoury

1 comment:

  1. Hello Richard,

    Thanks for your post. It is basically about the USE OF MATLAB in representing matrices when doing Finance.

    it is OK as a post, not related directly to the idea of real life situation problem, but acceptable. Something else would be great IF you have time!

    Zeina

    ReplyDelete