# Matlab; How to specify Coupon frequency for Interest Rate Swap

I'm trying to price an interest rate swap and would like to change the default coupon payment frequency from 1 a year to 2 or 4 a year. I'm using

Price = swapbyzero(RateSpec, LegRate, i, Maturity, 'Principal', Principal);


and tried

Price = swapbyzero(RateSpec, LegRate, i, Maturity, 'Principal', Principal,'Period',2);


where 'Period' is a valid option when pricing bond using

prbyzero


I'm using matlab 2013a

-

I don't know what is supported by MatLab (I use Java to do such stuff :-).

But in case you do not find a solution from the swapbyzero function you mentioned I can suggest a workaround:

• Value a swap with the annual fix frequence.

Given that it is a payer swap (pays the fixed leg), correct the value by:

• Substract the value of an annual fix coupon bond and
• Add the value of the desired frequence fix coupon bond.

PS: Note that the MatLab function is likely not appropriate to value a swap in a "realistic" way, since it looks like multi-curve (OIS discounting) is not considered here (I wonder if term structure is considered?), see also Rationale for OIS discounting for collateralized derivatives?

-

Name-Value pair option 'LegReset' [n n] where n is the frequency

-
Is this the answer? –  chrisaycock May 27 '13 at 15:07
Question was also asked on Stack Overflow, and this was the answer accepted. stackoverflow.com/questions/16764495/… –  Phil H May 31 '13 at 13:28