A totally lost student :)

1 view (last 30 days)
Oskar
Oskar on 8 Sep 2020
Answered: Steven Lord on 8 Sep 2020
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.

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 8 Sep 2020
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

More Answers (1)

Steven Lord
Steven Lord on 8 Sep 2020
The limits of the axes in your figure are different from the limits of the axes pictured in your textbook. Try changing the axes limits to better match those of the axes in your book and the two should look a lot more similar.
xlim([-5 5])
ylim([-7 1])

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!