% Problem # 15 (or Fichtenholz's Function # 5)
% Range of initial points: -5 <= x <= 5
% Global maxima: x=2.414213560038049
% f(x)=0.035533905932738
% Coded by: Ali R. Alroomi | www.al-roomi.org
 
clear
clc
warning off
 
xmin=-5;
xmax=5;
R=100000; % steps resolution
x=xmin:(xmax-xmin)/R:xmax;
 
for i=1:length(x)
    f(i)=(-x(i)^2+5*x(i)-6)/(x(i)^2+1);
end
 
plot(x,f,'r','LineWidth',2);grid;set(gca,'FontSize',12);
xlabel('x','FontName','Times','FontSize',20,'FontAngle','italic');
ylabel('f(x)','FontName','Times','FontSize',20,'FontAngle','italic');