How to set domain for p(x)/q(x) functions?

2 views (last 30 days)
Ayesha Marriyam
Ayesha Marriyam on 23 Sep 2018
Answered: Basil C. on 24 Sep 2018
My function is x-1/x-2 how can I plot this?

Answers (2)

Star Strider
Star Strider on 23 Sep 2018
Your function has a singularity at ‘x=2’. If you simply want to plot it, this works:
x = linspace(0, 4, 250);
f = @(x) (x-1)./(x-2);
figure
plot(x, f(x))
grid

Basil C.
Basil C. on 24 Sep 2018
You could just use this simple code instead
syms x
y=(x-1)/(x-2)
ezplot(y)

Categories

Find more on Symbolic Math Toolbox 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!