%
% plot11C.m
%
% Read (x,y) values and error bars from a data file and plot along with
% a reference line
%
% Matlab-Monkey.com
% 2/2/2019

% tidy-up your workspace
clc         % clear command window
clear       % clear all variables
close all   % close all graphics windows

data = load('run1.txt');  % read in the data file
x = data(:,1);            % extract x values from 1st column
y = data(:,2);            % extract y values from 2nd column
err = data(:,3);          % extract error bars from 3rd column

% plot data points with error bars
errorbar(x,y,err,'bo','MarkerFaceColor','b');

% plot reference line
hold on
plot([-1 8], [-1 9.5], 'r-')
 
% Label axes and give title
xlabel('x')
ylabel('y')

% Set axis limits for plot
xlim([-0.5 8])              % x axis goes from 0 to 4 pi
ylim([-2 10]);               % y axis goes from -4 to 4

% add a lengnd in the lower-right corner
legend({'experiment', 'theory'}, 'location','southeast')
