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

1 次查看(过去 30 天)
My function is x-1/x-2 how can I plot this?

回答(2 个)

Star Strider
Star Strider 2018-9-23
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. 2018-9-24
You could just use this simple code instead
syms x
y=(x-1)/(x-2)
ezplot(y)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by