figure;
hold all;
x = [-.001, -.0005, 0., .0005, .001];
K = [3.484986, 3.486288, 3.487610, 3.488899, 3.490171];
plot(x, K, '*');
title('K vs x, 21.0 C');
xlabel('x (m)');
ylabel('K');
grid on;
zoom on;
hold off;

p = polyfit(x, K, 1);
slope = p(1);
intercept = p(2);
x_line = [min(x), max(x)];
y_line(1) = slope * x_line(1) + intercept;
y_line(2) = slope * x_line(2) + intercept;
line(x_line, y_line, 'color', 'r', 'linewidth', 1);
text(mean(x_line), mean(y_line) - 0.1 * (y_line(2) - y_line(1)), ['Slope dK/dx = ', num2str(slope), ' 1/m'], 'color', 'r');
text(mean(x_line), mean(y_line) - 0.2 * (y_line(2) - y_line(1)), ['Slope dK/K/dx = ', num2str(slope / K(3)), ' 1/m'], 'color', 'r');
