MATLAB: Linear regression linear regression i have a table of data X = 1,2,3,4,5,6,7,8,9 Y= 4 5 6 9 8 7 4 1 2 how can i plot these points without having a line then using linear regression to find the uncertainty with a 95% confidence interval and plot that? Best Answer % Define sample data.X = [1,2,3,4,5,6,7,8,9];Y = [4 5 6 9 8 7 4 1 2];% Do the plotting:plot(X, Y, 'bo', 'LineWidth', 3, 'MarkerSize', 15);grid on;% Maximize the figure window.set(gcf, 'units','normalized','outerposition',[0 0 1 1]);% Label the various parts of the plot.fontSize = 20;title('lowcalorie Plot', 'FontSize', fontSize);xlabel('X', 'FontSize', fontSize);ylabel('Y', 'FontSize', fontSize);coefficients = polyfit(X, Y, 1);fittedY = polyval(coefficients, X);hold on;% Do the plotting:plot(X, fittedY, 'rs-', 'LineWidth', 3, 'MarkerSize', 15);legend('Y', 'Fitted Y'); Related SolutionsMATLAB: SUBPLOT : UPPER & LOWER PLOT %truefor i = 1: 6 subplot(6,2,i) y = cos(i*x); plot(x,y) title(sprintf('y = cos(%dx)', i));end MATLAB: Plotting data Um, did you look up "plot" in the help? Did you find anything like this:plot(X, Y);Or even fancier:% Define sample data.X = [1,2,3,4,5,6,7,8,9];Y = [4 5 6 9 8 7 4 1 2];% Do the plotting:plot(X, Y, 'bo-', 'LineWidth', 3, 'MarkerSize', 15);grid on;% Maximize the figure window.set(gcf, 'units','normalized','outerposition',[0 0 1 1]);% Label the various parts of the plot.fontSize = 20;title('lowcalorie Plot', 'FontSize', fontSize);xlabel('X', 'FontSize', fontSize);ylabel('Y', 'FontSize', fontSize); Related QuestionAdjusting label and title thickness of the plot functionWhat is the code to plot thisHow plot to matrices in 3DCan you please help to plot this figure in matlabIs it rightAre these polyfit curves correct
Best Answer