You are not accepting the coefficients from polyfit() - they basically are thrown away. Even if you did do
coefficients = polyfit(climb, calories, 2);
you still need to compute the fitted values, like
numFitPoints = 1000;
xFit = linspace(min(climb), max(climb), numFitPoints);
yFit = polyval(coefficients, xFit);
hold on;
plot(xFit, yFit, 'r-', 'LineWidth', 2);
grid on;
See attached demo, which produces the plot below.
Best Answer