% Assuming you have the x and y datax = [1, 2, 3, 4, 5];
y = [2, 3, 5, 6, 5];
% Specifying the degree of the polynomial fitdegree = 2;
% Performing the polynomial fitcoefficients = polyfit(x, y, degree);
% Creating a range of x values for plottingxRange = 1:0.1:5;
yFit = polyval(coefficients, xRange);
% Plotting the original data points and the fitted polynomial curveplot(x, y, 'o', xRange, yFit);
legend('Data', 'Fitted curve');