

% plot the log-log curve and gives the uncertanity in the fit 

x=[84.4,99.5,209.3,270.2,328,338.3,409.5,463,772,794.9,835.7,911.2,964.8,969,238.6,300,727.3];
y=[14476147.54,15905703.13,9282345.361,8378688.047,7881423.729,8290707.965,6994329.897,6605225.225,4189400,4122752.294,2930807.453,3609563.91,3145792.564,3448104.938,10831220.18,8789640.719,4840706.767];

figure; hold on;
loglog(x, y, '.');
% fit in log domain
p = polyfit(log(x), log(y), 1);
% compute fit in linear domain
y_hat = exp(p(1) * log(x) + p(2));
% make log log plot
loglog(x, y_hat);

label = ['log(y) = ' num2str(p(1)) 'log(x) + ' num2str(p(2))];
legend('data', label);

polyval(p,x,s);

