Visual DisplayΒΆ

There are a plethora of visual display options in Matlab. In this section we will show you how to plot the daily S&P 500 stock index over 2013 and add labels and titles

  • If you didn’t complete the previous sections, you can download the data series HERE. Once you have downloaded the Matlab file, place it in your active Matlab “Current Folder”. Then type “load data”.

  • To plot the daily S&P 500 price index, use the plot(x,y) function

  • Use “datetick(‘x’,’mmm-yy’)” to convert Matlab dates to regular dates

  • Change the title and axis labels with title(‘label’), ylabel(‘label’) and xlabel(‘label’), where ‘label’ is the word(s) you like to appear on the graph

  • “grid on” will add the major grid lines to your graph
_images/plot1.png
  • You should get a figure that looks like:
_images/plot2.png

For more information on plotting see: Mathworks-Plots or move on to the next section