Fourier transform of symbolic function

46 次查看(过去 30 天)
Hi. I would like to see the magnitude and phase spectrum of a symbolic function. I tried using the 'fourier' function on a basic symbolic expression, but it didn't work.
syms t w;
x=sin(2*t);
X=fourier(x);
fplot(abs(X)) // Nothing in this figure
Doing the transform manually works:
T=10;
fX=int(x* exp(1j*w*t), t, -T, T);
fplot(abs(X)/T) // This works
Please can someone let me know how to see the phase and magnitude responses using the 'fourier' function ?
Many thanks
-s

采纳的回答

Paul
Paul 2022-9-10
编辑:Paul 2022-9-10
Hi soup,
The Fourier transform of x is
syms t w;
x=sin(2*t);
fourier(x)
ans = 
fplot() ignores Dirac delta functions. Because there is nothing else to plot, fplot() is empty
The "manual transform"
T = 10; % not sure why T = 10?
simplify(int(x* exp(1j*w*t), t, -T, T),100)
ans = 
isn't the Fourier transform of x. Rather, it's the Fourier transform of the x multiplied by a rectangular window of length 2T.
sympref('FourierParameters',[1 1]);
simplify(fourier(x*rectangularPulse(-T,T,t)),100)
ans = 
  3 个评论
Paul
Paul 2022-9-10
编辑:Paul 2022-9-10
As you're seeing, the Fourier transform integral doesn't converge for a periodic signal. However, we can define the Fourier transform of a periodic signal as a Dirac delta impulse train scaled by the signal's Fourier series coefficients, which is exactly what we see as the Fourer transform of a sin function. See this link, for example, for further discussion. Matlab's fourier function knows how to deal with basic periodic functions, like sin and complex exponentials.
Any plot of a signal that contains a Dirac delta will be artifcial. The concept of "magnitude" doesn't really apply to a Dirac delta. Can't really plot it, just have to make up some symbol, like a vertical arrow, to signify where the Dirac delta sits on the real line, as is done in the linked reference.
soup
soup 2022-9-10
Thank you very much. I'll read the article : )
-s

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by