Error using plot ; spectrum of function

1 次查看(过去 30 天)
Why I get error using the following code?
syms t w;
syms g h;
g=fourier(exp(-1*(t^2)));
h=abs(g);
w=-10.1:10.1;
plot(w,h);

采纳的回答

Walter Roberson
Walter Roberson 2017-11-1
plot(w, subs(h))
  3 个评论
Walter Roberson
Walter Roberson 2017-11-1
Worked fine when I tried on the code you posted.
If you have other code for calculating spectra then you should probably post that so we do not have to guess about what might not be working.
geometry geometry
geometry geometry 2017-11-2
Yes thanks! I'm sorry it works fine. (I was using fplot instead of plot).

请先登录,再进行评论。

更多回答(1 个)

Karan Gill
Karan Gill 2017-11-1
Plot symbolic functions by using fplot.
fplot(h)
  1 个评论
geometry geometry
geometry geometry 2017-11-1
Thanks but it doesn't plot spectrum of f(t) correctly. I want to plot the spectrum of arbitrary function for example exp(-t^2) , dirac(t), ...
could you help me?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by