Difference between revisions of "Graphing"
(→Line Plots) |
|||
Line 2: | Line 2: | ||
= Line Plots = | = Line Plots = | ||
+ | |||
+ | |||
+ | |||
+ | For this example we use one of Matlab's sample dataset to plot a simple line plot showing the time series movement of the stock market data. | ||
+ | First Load the data. | ||
+ | <source> | ||
+ | load stockreturns | ||
+ | </source> | ||
+ | |||
+ | The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the 'plot' function. | ||
+ | |||
+ | <source> | ||
+ | figure | ||
+ | plot(stocks(:)) | ||
+ | </source> | ||
+ | |||
+ | [[File:lineplot1.png]] | ||
+ | |||
+ | <source> | ||
+ | sd=std(stocks(:); | ||
+ | hold on | ||
+ | plot(xlim, [sd sd],'--r') | ||
+ | plot(xlim, [-sd -sd],'--r') | ||
+ | </source> | ||
+ | |||
+ | [[File:lineplot2.png]] | ||
= Scatter Diagrams = | = Scatter Diagrams = |
Revision as of 19:19, 23 October 2015
Contents
Introduction
Line Plots
For this example we use one of Matlab's sample dataset to plot a simple line plot showing the time series movement of the stock market data. First Load the data.
load stockreturns
The data contains a (100x10) matrix of stock market observations and we are going to plot all of these data point on a single line plot using the 'plot' function.
figure
plot(stocks(:))
sd=std(stocks(:);
hold on
plot(xlim, [sd sd],'--r')
plot(xlim, [-sd -sd],'--r')