I want to add a line of best fit to my plot using the polyfit function. However, the graph turns blank when I integrate polyfit in my code. How can I change it to make polyfit work?
% original graph without line of best fit
rideData; % file that contains arrays of data/numbers for climb and calories
figure(1);plot(climb, calories, "o");xlabel('climb');ylabel('calories');% new graph with polyfit. it turns blank
rideData; % file that contains arrays of data/numbers for climb and caloriesfigure(1);polyfit(climb, calories, "o");xlabel('climb');ylabel('calories');
Best Answer