plotting function which contain zero denominator term

조회 수: 1 (최근 30일)
shree thapa
shree thapa 2021년 1월 29일
댓글: Walter Roberson 2021년 1월 29일
I have a function : . I need to plot a graph between x Vs g(x) where
, I just need values of x from o to without x=1 because it will give me which doest not make sense.
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
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)
shree thapa
shree thapa 2021년 1월 29일
Yes, You right x is variable so you will get different g(x) for different x so the just plot.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 29일
syms x
f(x) = 1/(1-x^2)
f(x) = 
g(x) = int(f(x), x, 0, inf)
g(x) = 
NaN
g(x) is always undefined, no matter what the value of x is.
ratio = f(x)/g(x)
ratio = 
NaN
fplot(ratio, [0 20])
Notice the plot is empty. Because every entry is NaN.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 1월 29일
syms x
f(x) = piecewise(x < 1, 1/(1-x^2), x == 1, 0, -1/(1-x^2))
f(x) = 
a = int(f(x), x, 0, 1)
a = 
b = int(f(x), x, 1, inf)
b = 
a+b
ans = 
g(x) = int(f(x), x, 0, inf)
g(x) = 
ratio = f(x)/g(x)
ratio = 
0
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 CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by