Why Does int() of rectangularPulse Return NaN?

syms t real
x(t) = rectangularPulse(0,1,t);
int(x(t),t,0,5)
ans = 
1
int(x(t),t,0,inf)
ans = 
NaN
int(x(t),t,-10,10)
ans = 
1
int(x(t),t,-inf,inf)
ans = 
NaN
Any ideas why those two cases return NaN?

1 件のコメント

Paul
Paul 2022 年 5 月 25 日
Fixed in 2022a
syms t real
x(t) = rectangularPulse(0,1,t);
int(x(t),t,0,inf)
ans = 
1
int(x(t),t,-inf,inf)
ans = 
1
int(rectangularPulse(0,1,t),-2,inf)
ans = 
1

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2021 年 7 月 9 日

0 投票

Work-around:
syms b x t real
assume(b>=0)
y(t) = rectangularPulse(x,1,t)
y(t) = 
z = int(y,t,0,b)
z = 
limit(z, b, inf)
ans = 

4 件のコメント

Paul
Paul 2021 年 7 月 9 日
Seems like this should be pretty simple function for int() to deal with. Does this seem like a bug?
Walter Roberson
Walter Roberson 2021 年 7 月 10 日
編集済み: Walter Roberson 2021 年 7 月 10 日
I am not sure why this is happening. You can read the internal code for rectangularPulse by using
regexprep(char(feval(symengine, 'expose', 'rectangularPulse')),'\\n','\n')
but that doesn't tell you anything about how it integrates. The symbolic integration routine is too large for me to chase through.
Paul
Paul 2021 年 7 月 10 日
編集済み: Paul 2021 年 7 月 10 日
Just seems so strange because int() handles much more complex functions, which is just about any function, with ease. I'll see what Tech Support says about this.
Another interesting result:
syms t real
int(rectangularPulse(0,1,t),-inf,2)
ans = 
1
int(rectangularPulse(0,1,t),-2,inf)
ans = 
NaN
Walter Roberson
Walter Roberson 2021 年 7 月 10 日
I have a suspicion that somewhere along the way, a dirac(0) is getting invoked.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2021a

質問済み:

2021 年 7 月 9 日

コメント済み:

2022 年 5 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by