www.gusucode.com > econ 案例源码程序 matlab代码 > econ/ConvertBetweenStockPricesAndReturnsExample.m
%% Convert Between Stock Prices and Returns %% % Create a stock price process continuously compounded at 10 percent % Copyright 2015 The MathWorks, Inc. S = 100*exp(0.10*[0:19]'); % Create the stock price series %% % Compute 10 percent returns for reference R = price2ret(S); % Convert the price series to a % 10 percent return series %% % Convert the resulting return series to the original price series, and compare results: P = ret2price(R, 100); % Convert to the original price % series [S P] % Compare the original and % computed price series