Price-Yield Curve with Matlab

728 Views Asked by At

Not sure if this is the right place to ask but I was wondering if anyone has an idea about how to draw a Price-Yield curve. Is there ready-to-use formulas for this purpose ? An example of curve and formula used is below. Let me know if you require further explanation. Sorry for the formatting of the question by the way (big picture, lots of white space) Graph

$$P=\frac{F}{[1+(\lambda/m)]^n}+\sum_{k=1}^n\frac{C/m}{[1+(\lambda/m)]^k}$$ $$=\frac{F}{[1+(\lambda/m)]^n}+\frac{C}{\lambda}\left\{1-\frac{1}{[1+(\lambda/m)]^n}\right\}.$$

1

There are 1 best solutions below

1
On BEST ANSWER

Face value is 100:

F = 100

Coupon is 5%:

C = 5

Quarterly coupon payments:

m = 4

Five year maturity:

T = 5

Total number of payments:

n = m * T

Range of yields 1% to 20%:

y = 0.01:0.01:0.2

Prices:

P = F./(1+y/m).^n + C./y.*(1-1./(1+y/m).^n)

Plot price against yield:

plot(y,P)

Voila:

enter image description here