%% Determine Multiple Mortgage-Backed Securities Yields Given the Price
% This example shows how to determine multiple mortgage-backed securities yields, given a portfolio of mortgage-backed securities with the following characteristics.

Price = 102;
Settle = datenum(['13-Feb-2000';'17-Apr-2002';'17-May-2002';... 
'13-Jan-2000']);
Maturity  = datenum('1-Jan-2030');
IssueDate = datenum('1-Jan-2000');
GrossRate = 0.08125;
CouponRate = [0.075; 0.07875; 0.0775; 0.08125];
Delay = 14;
Speed = 100;

[MYield, BEMBSYield] = mbsyield(Price, Settle, Maturity,... 
IssueDate, GrossRate, CouponRate, Delay,  Speed)

% Copyright 2015 The MathWorks, Inc.