Error using plot ; spectrum of function

1 Ansicht (letzte 30 Tage)
geometry geometry
geometry geometry am 1 Nov. 2017
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);

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Nov. 2017
plot(w, subs(h))
  3 Kommentare
Walter Roberson
Walter Roberson am 1 Nov. 2017
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 am 2 Nov. 2017
Yes thanks! I'm sorry it works fine. (I was using fplot instead of plot).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Karan Gill
Karan Gill am 1 Nov. 2017
Plot symbolic functions by using fplot.
fplot(h)
  1 Kommentar
geometry geometry
geometry geometry am 1 Nov. 2017
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?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by