MATLAB: A totally lost student :)

equation

I have been trying to solve a problem for a while now on MATLAB but am not coming anywhere. I have made a graph that i think is good but if you compare it to solution and my graph they are not the same. The question is;
It is often quite difficult to determine the range of a function exactly. Use a graphing utility (calculator or computer) to graph the function f, and by zooming in on the graph, determine the range of f with accuracy of 2 decimal places.
f(x)= (x-1)/(x^2+x)
my code:
>> f=@(x) (x-1)./(x.^2+x);
>> x=-25:0.1:25;
>> y=f(x);
>> plot(x,y)
please help and tell my why my graph is not the same as the solution.

Best Answer

Hi,
Here is the corrected solution to your exercise.
f=@(x) (x-1)./(x.^2+x);
x=[-25:0.1:-1, 0:.1:25;]; y=f(x); plot(x,y), grid on, shg