www.gusucode.com > econ 案例源码程序 matlab代码 > econ/CompareTheRelativePricePerformanceOfStocksExample.m

    %% Compare the Relative Price Performance of Stocks
% This example compares the relative price performance of the NASDAQ and the NYSE indexes.
%%
% Load the equity index data.

% Copyright 2015 The MathWorks, Inc.

load Data_EquityIdx
%%
% Convert the returns back to prices, specifying the same starting price,
% |100|, for each series, and plot the results.
figure;
plot(ret2price(price2ret([DataTable.NASDAQ DataTable.NYSE]), 100))
ylabel('Prices')
legend('Nasdaq', 'NYSE','Location','Best')
axis tight
%%
% The blue (upper) plot shows the |NASDAQ| price series. The green (lower) plot shows the |NYSE| price series.