clc
clear
x = [25, 30, 35, 40, 45];
y = [5, 260, 480, 745, 1100];
plot(x, y, 'bo', 'Markersize',8);
hold on;
linear_fit= polyfit(x, y, 1);
exponential_fit= fit(x', y', 'exp1');
power_fit= fit( x', y', 'power1');
x_values= linspace(min(x), max(x), 100);
y_linear= polyval(linear_fit, x_values);
y_exponential= exponential_fit.a * exp(exponential_fit.b * x_values);
y_power= power_fit.a * x_values.^power_fit.b;
plot(x_values, y_linear, 'r-', 'LineWidth',2);
plot(x_values, y_exponential, 'g-', 'LineWidth',2);
plot(x_values, y_power, 'm-', 'LineWidth',2);
xlabel('x');
ylabel('y');
legend( 'Data', 'Linear Fit', 'Exponential Fit','Location', 'northwest' );
grid on;
hold off;
To embed this project on your website, copy the following code and paste it into your website's HTML: