% The following script produces a figure of a linear fit of the velocity
% of action potentials as a function of diameter. The data is called
% 'hursh' as it is taken from a study in 1939 by Hursh.
dhursh = csvread('hursh.csv', 1, 0);
% This fits a linear model for hursh, with the third argument, '1',
% specifying the order of the model.
lmhursh = polyfit(dhursh(:, 1), dhursh(:, 2), 1);
% 'ko' specifies the line type.
plot(dhursh(:, 1), dhursh(:, 2), 'ko', 'MarkerSize', 5)
% Set labels.
xlabel({''; 'Diameter (microns)'}, 'FontSize', 22)
ylabel('Velocity (m/s)', 'FontSize', 22)
% Set graphical parameters for limits.
set(gca, 'XLim', [0, 20], 'YLim', [0, 120])
% Plot a line, using the parameters of the model, called 'lmhursh'.
regline = refline(lmhursh(1, 1), lmhursh(1, 2));
% Stylize the line, set additional graphical parameters, and then set the
% figure location and size (200 pixels from the left, 100 from the top,
% with a width of 900 and a height of 800).
set(regline, 'Color', 'k')
set(gca,'Box','off', ...
'FontSize', 22, ...
'XLim', [0, 20], ...
'YLim', [0, 120], ...
'XTick', 0:5:20, ...
'YTick', 0:20:120, ...
'TickDir', 'out');
set(gcf, 'Position', [200, 100, 1100, 900])