clc
clear
f = @(x) 2*x.^2 - 5*x + 7;
x = -2:0.1:4;
y = f(x);
plot(x,y,'b','LineWidth',2)
grid on
xlabel('x')
ylabel('f(x)')
title('Plot of f(x) = 2x^2 - 5x + 7')
[xmin, fmin] = fminbnd(f, -2, 4);
fprintf('Minimum occurs at x = %.4f\n', xmin);
fprintf('Minimum function value = %.4f\n', fmin);
hold on
plot(xmin, fmin, 'p', 'MarkerSize',10, 'MarkerFaceColor','r')
legend('f(x)', 'Minimum Point')
To embed this project on your website, copy the following code and paste it into your website's HTML: