From: Khanh N. <kn...@cs...> - 2009-05-17 02:08:21
|
Hi all, I am replicating this the first example from this page http://www.mathworks.com/access/helpdesk/help/toolbox/finfixed/zeroyield.html Matlab: Example 1. Compute the yield of a short-term zero-coupon instrument. Settle = '24-Jun-1993'; Maturity = '1-Nov-1993'; Basis = 0; Price = 95; Yield = zeroyield(Price, Settle, Maturity, [], Basis) Yield = 0.1490 Code code look like this int main() { double settlementDays = 1; Date settleDate(24, (Month)6, 1993); Date maturityDate(1, (Month)11, 1993); DayCounter dc = ActualActual(); BusinessDayConvention bdc = ModifiedFollowing; double faceAmount = 100; double redemption = 100; ZeroCouponBond bond1(settlementDays, UnitedStates(UnitedStates::GovernmentBond), faceAmount, maturityDate, bdc, redemption, settleDate); cout << bond1.yield(95, ActualActual(), Simple ,Annual); } it compiles, but returns "what(): root not bracketed: f[0,1] -> [nan, nan]" Any help, please? Thanks. -k |