Problem Plotting Fourier Transforms of Sine waves

5 ビュー (過去 30 日間)
Matt
Matt 2012 年 12 月 11 日
Hello!
So let me start off by saying that I barely use MatLab. However, my professor assigned us a homework in which we have to find the fourier transform of a multiplication of sine waves and plot it. This is what I am trying..
>> syms x y
>> f=sin(2*x)*sin(5*x)
f =
sin(2*x)*sin(5*x)
>> g=fourier(f)
g =
2*transform::fourier(cos(x)*sin(x)^6, x, -w) - 20*transform::fourier(cos(x)^3*sin(x)^4, x, -w) + 10*transform::fourier(cos(x)^5*sin(x)^2, x, -w)
>> ezplot(fourier(g))
??? Error using ==> char
Cell elements must be character arrays.
Error in ==> ezplot at 160
fmsg = char(f);
Error in ==> sym.ezplot at 45
h = ezplot(char(f));
Why am I getting this error? How can I plot the Fourier transforms of these sine waves?
Any help would be appreciated!!
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 12 月 11 日
Note that fourier(g) would be trying to take the fourier transform of something that is already a fourier transform, since g is fourier(f)

サインインしてコメントする。

回答 (2 件)

Jonathan Epperl
Jonathan Epperl 2012 年 12 月 11 日
What version of Matlab and the Symbolic Toolbox are you using? I am using Matlab 2012b with the Symbolic Toolbox Version 5.9 and I get nothing like that. Your output looks like mupad syntax of the same command.
But is your prof asking you to use Matlab for that? This is very easily done by hand, the FT of your product is going to be a convolution of Dirac delta impulses; you'll have trouble plotting that anyway.

Walter Roberson
Walter Roberson 2012 年 12 月 11 日
If you are working symbolically then you are calculating the theoretical continuous fourier transform. In order to plot a continuous fourier transform properly, you need an infinite number of points. It is not possible to plot an infinite number of points.
I suggest you consider using the discrete fourier transform, fft().

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by