www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/CreateaStockSpecforStocksWithCashandContinuousDividendsExample.m

    %% Create a |StockSpec| for Stocks With Cash and Continuous Dividends

% Copyright 2015 The MathWorks, Inc.


%% 
% Consider two stocks that are trading at $40 and $35. The first one provides
% two cash dividends of $0.25 on March 1, 2008 and June 1, 2008. The second
% stock provides a continuous dividend yield of 3%. The stocks have a volatility
% of 30% per annum. Using this data, create the structure |StockSpec|: 
AssetPrice = [40; 35];
Sigma = .30;

DividendType = {'cash'; 'continuous'};
DividendAmount = [0.25, 0.25 ; 0.03 NaN];

DividendDate1 = 'March-01-2008';
DividendDate2 = 'Jun-01-2008';

StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmount,...
{ DividendDate1, DividendDate2 ; NaN NaN})  

%% 
% Examine the |StockSpec| structure. 
datedisp(StockSpec.ExDividendDates)
StockSpec.DividendType 

%%
% The |StockSpec| structure encapsulates the information of the two stocks
% and their dividends.