How do I get error on my experimental data (for EGR 1010)



% Ok, let us say we have some measured data y at x.

%
% The data is x which is a distance (for example) that we will assume is errorless (not completely correct,
% but good enough here. The test data is y which is time (for example). We will repeat the experiment at
% the same distance at least five times (seven is better) in order to get a good representative
% value (the mean). Associated with this value will be an error (standard deviation)
%

%
% So at distance 1 feet we measured times of 2.200 sec, 2.000 sec, 2.400 sec, 1.600 sec, 1.065 sec,
% 1.800 sec,and 2.935 sec. %

y1 = [2.200,2.000,2.400,1.600,1.065,1.800,2.935];
mean(y1)
% ans = 2
std(y1)
% ans = 0.59839 -- which for clarity purposes I used as 0.6 for sy.

%
% So at distance 2 feet we measured times of 4.0500 sec, 4.000 sec, 4.1500 sec, 3.6900 sec, 3.8500 sec,
% 3.9500 and 4.3100 sec. %

y2 = [4.0500,4.0000,4.1500,3.6900,3.8500,3.9500,4.3100];
mean(y2)
% ans = 4
std(y2)
% ans = 0.200991 -- which for clarity purposes I used as 0.2 for sy.
%
% Repeat for all the other x values...how many x's you use will depend on what type of fit you wish
% to achieve. For a linear fit you need at least 3 values of x, for a quadratic fit
% you need at least 4 values of x, for a cubic fit you need at least 5 values of x, and for
% a quartic at least 6 values of x, and so on. Obviously more data points would always be preferable
% to get the best fit possible. This assumes polynomial fits, if it is an exponential fit (or sinusoidal)
% then you should have even more values of x.
%
% x = [1,2,{other values}];
% y = [2,4,{other values}];
% sy =[0.6,0.2,{other values}];
%