Financial Time Series Toolbox | ![]() ![]() |
Calculate the Dividend Rate
The last part of the task is to calculate the dividend rate from the stock price data. Calculate the dividend rate by dividing the dividend payments by the corresponding closing stock prices.
First check to see if you have the stock price data on all the dividend dates:
datestr(d0.dates, 2) ans = 04/15/99 06/30/99 10/02/99 12/30/99 t0(datestr(d0.dates)) ans = 'desc:' 'Inc' '' 'freq:' 'Daily (1)' '' '' '' '' 'dates: (3)' 'Close: (3)' 'Spot: (3)' '04/15/99' '10.3369' '10.3369' '06/30/99' '11.4707' '11.4707' '12/30/99' '11.2244' '11.2244'
Note that stock price data for October 2, 1999 does not exist. The fillts
function can overcome this situation; fillts
allows you to insert a date and interpolate a value for the date from the existing values in the series. There are a number of interpolation methods. See fillts
in the Function Reference for details.
Use fillts
to create a new time series containing the missing date from the original data series. Then set the frequency indicator to daily:
tdr = d0./fts2mtx(t1.Close(datestr(d0.dates))) tdr = 'desc:' 'Inc' 'freq:' 'Unknown (0)' '' '' 'dates: (4)' 'Dividends: (4)' '04/15/99' '0.0193' '06/30/99' '0.0305' '10/02/99' '0.0166' '12/30/99' '0.0134'
![]() | Plot the Results | Technical Analysis | ![]() |