Problem Plotting Fourier Transforms of Sine waves

3 Ansichten (letzte 30 Tage)
Matt
Matt am 11 Dez. 2012
Beantwortet: KASTHURI am 29 Jul. 2024
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 Kommentar
Walter Roberson
Walter Roberson am 11 Dez. 2012
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)

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Jonathan Epperl
Jonathan Epperl am 11 Dez. 2012
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 am 11 Dez. 2012
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().

KASTHURI
KASTHURI am 29 Jul. 2024
Find the fourier transform of where a is a positive real number hence deduce that

Community Treasure Hunt

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

Start Hunting!

Translated by