This is a small program that calculates the relative change (in %) in the n-year spot rate if a n-year zero-coupon bond price moves from q% to (1+k%)q%, where q% is the quoted price.
For this project, we have:
- Inputs: n (year), q (the n-year zero-coupon bond price as % of par), k (the increment in bond price, also as % of par).
- Output: the change in the n-year spot rate in %.
In MatLab, type
calculateChange(10,60,1)
Assume n=10, q=60, k=1. Then the change in the n-year spot rate is −1.9971%.