MATLAB 符号表达式:如何强制答案为 sin(alpha)/alpha
MATLAB symbolic expression: How to force the answer to be sin(alpha)/alpha
syms x alpha
L =1;
cn = (1/2)*int(exp(-j*alpha*x),x,-L,L)
cn 应该是 sin(alpha)/alpha
.
但是Matlab的回答如下:
cn =
(2^(1/2)*sin(alpha)*i)/(2*(alpha*i)^(1/2)*(alpha*(i/2))^(1/2))
使用 simplify 或 simple,我不能强制 cn = sin(alpha)/alpha。怎么强制?
非常感谢您的帮助
如果您使用 simplify(cn,'IgnoreAnalyticConstraints',true)
,您会得到想要的结果。该选项的文档说:
Apply purely algebraic simplifications to an expression. simplify can return simpler results for expressions for which it would return more complicated results otherwise. Setting IgnoreAnalyticConstraints to true can lead to results that are not equivalent to the initial expression.
我从未见过返回 "wrong" 结果的选项。如果您对进一步的解释感兴趣,可以阅读 ths blog entry。
syms x alpha
L =1;
cn = (1/2)*int(exp(-j*alpha*x),x,-L,L)
cn 应该是 sin(alpha)/alpha
.
但是Matlab的回答如下:
cn =
(2^(1/2)*sin(alpha)*i)/(2*(alpha*i)^(1/2)*(alpha*(i/2))^(1/2))
使用 simplify 或 simple,我不能强制 cn = sin(alpha)/alpha。怎么强制?
非常感谢您的帮助
如果您使用 simplify(cn,'IgnoreAnalyticConstraints',true)
,您会得到想要的结果。该选项的文档说:
Apply purely algebraic simplifications to an expression. simplify can return simpler results for expressions for which it would return more complicated results otherwise. Setting IgnoreAnalyticConstraints to true can lead to results that are not equivalent to the initial expression.
我从未见过返回 "wrong" 结果的选项。如果您对进一步的解释感兴趣,可以阅读 ths blog entry。