Should sympref Change the Behavior of rectangularPulse()?

1 次查看(过去 30 天)
  • If x = a or x = b and a <> b, then the rectangular pulse function equals 1/2.
Verify this statement:
rectangularPulse(0,1,[0 1])
ans = 1×2
0.5000 0.5000
syms t real
h(t) = heaviside(t) - heaviside(t-1);
h([0 1])
ans = 
But changing the sympref for HeavisideAtOrigin yields:
sympref('HeavisideAtOrigin',sym(1));
rectangularPulse(0,1,[0 1])
ans = 1×2
1 1
h([0 1])
ans = 
So rectangularPulse appears to not be the difference between heavisides. But the sympref('HeavisideAtOrigin') does impact the edge values of rectangularPulse. Is this expected behavior and a deficiency in the documentation?
  2 个评论
Walter Roberson
Walter Roberson 2021-8-1
By the way, you can see the actual code by using
regexprep(char(evalin(symengine, 'expose(rectangularPulse)')),'\\n','\n')
but it is not straight forward.
Paul
Paul 2021-8-1
After running that command, it sure looks like that under "normal" conditions, the edge values are heaviside(0). So that would be an oversight in the documentation.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by