plotting function which contain zero denominator term
1 次查看(过去 30 天)
显示 更早的评论
I have a function :
. I need to plot a graph between x Vs g(x) where
My Question: How can I use "if and elseif" syntax to plot grap between x Vs g(x) excluding value x=1 and inclusing rest of others.
5 个评论
Walter Roberson
2021-1-29
Okay, so suppose I choose x = 7. Then what would the expected plot be?
is constant because the integral "uses up" all of the unbound variables in f(x)
回答(1 个)
Walter Roberson
2021-1-29
syms x
f(x) = 1/(1-x^2)
g(x) = int(f(x), x, 0, inf)
g(x) is always undefined, no matter what the value of x is.
ratio = f(x)/g(x)
fplot(ratio, [0 20])
Notice the plot is empty. Because every entry is NaN.
1 个评论
Walter Roberson
2021-1-29
syms x
f(x) = piecewise(x < 1, 1/(1-x^2), x == 1, 0, -1/(1-x^2))
a = int(f(x), x, 0, 1)
b = int(f(x), x, 1, inf)
a+b
g(x) = int(f(x), x, 0, inf)
ratio = f(x)/g(x)
fplot(ratio, [0 20])
So you can define away the integral so that you do not get nan (by integrating a different function), but you are stuck with the problem that g(x) is constant.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


