MATLAB中绘制符号变量的错误?
我正在尝试从
第312页的“信号和系统实验室”中学习傅立叶变换,以下是遵循代码的,这表明可以通过乘以两个信号的傅立叶变换来实现卷积
syms t w
x1=heaviside(t)-heaviside(t-2);
x2=heaviside(t)-heaviside(t-4);
X1=fourier(x1,w);
X2=fourier(x2,w);
right=ifourier(X1*X2,t)
ezplot(right)
我尝试了MATLAB 2019和MATLAB 2020,但是
实际上,当我尝试在MATLAB中运行代码上方时,我都会
Error using inlineeval (line 14)
Error in inline expression ==> (t.*pi.*sign(t) + fourier(cos(2.*w)./w.^2, w, -t) +
fourier(cos(4.*w)./w.^2, w, -t) - fourier(cos(6.*w)./w.^2, w, -t) - fourier(sin(2.*w)./w.^2, w,
-t).*1i - fourier(sin(4.*w)./w.^2, w, -t).*1i + fourier(sin(6.*w)./w.^2, w, -t).*1i)./(2.*pi)
Undefined function 'fourier' for input arguments of type 'double'.
Error in inline/feval (line 33)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ezplotfeval (line 53)
z = feval(f,x(1),y(1));
Error in ezplot>ezimplicit (line 271)
u = ezplotfeval(f, X, Y);
Error in ezplot (line 167)
hp = ezimplicit(cax, f{1}, vars, labels, args{:});
Error in sym/ezplot (line 66)
h = ezplot(fhandle(f)); %#ok<EZPLT>
Error in Untitled (line 7)
ezplot(right)
遇到同样的问题。 a href =“ https://i.sstatic.net/o5suz.jpg” rel =“ nofollow noreferrer”>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 matlab答案。解决的解决方案
walter roberson> .com/help/symbolic/rewrite.html“ rel =“ nofollow noreferrer”>重写
x1*x1*x2
在exp
中,在服用逆傅立叶变换。引用MATLAB答案:结果(在R2021b上):
I found the same question on MATLAB Answers. The solution as posted by
Walter Roberson is to rewrite
X1*X2
in terms ofexp
before taking the inverse fourier transform. Quoting from MATLAB Answers:Result (on R2021b):
看来matlab不能
x1*x2
,因此它将反傅立叶变换返回,作为未评估的呼叫转换为傅立叶。ezplot
或fplot
无法绘制这样的表达式。It looks like matlab cannot transform the function
X1*X2
, so it returns the inverse fourier transform as an unevaluated call to fourier.ezplot
, orfplot
can not plot a expression like this.