For my purposes here (and since you didn’t post it), I’m using ‘k’ as the loop index. So assume this loop:
for k = ...
x1(k) = Timestep;
y1(k) = LogPriceReturn;
x2(k) = Timestep;
y2(k) = StockPrice;
end
figure(1);
plot(x1,y1, 'Marker','o', 'MarkerFaceColor','black'); hold on
title('Log Price Return');
xlabel('Timestep');
ylabel('Log Price Return Graph');
axis([1 n -1 1]);
figure(2)
plot(x2,y2, 'Marker','o', 'MarkerFaceColor', 'black'); hold on
title('Stock Price');
xlabel('Timestep');
ylabel('Stock Price');
axis([1 n -inf inf]);
NOTE — This is UNTESTED CODE. It should work, but may require minor modification.
Best Answer