Solving a Problem with Fourier Transform in Mathematica

  • Mathematica
  • Thread starter natski
  • Start date
  • Tags
    Mathematica
In summary, the problem with the plot is that it doesn't take into account that the function is zero at some points. You can resolve this by creating a list of values for the function and plotting it that way.
  • #1
natski
267
2
I've tried a simple plot of the FT of a simple cosine function with respect to omega and got some unimpressive results. The command I tried was:

Plot[FourierTransform[Cos[3000 t], t, ω], {ω, 2000, 4000}]

So I was expecting a nice delta function at 3000 but it's not visible or not present on the plot. How I can resolve this problem to see a spike?
 
Physics news on Phys.org
  • #2
I tride this myself yesterday and there is really a quite a large collection of problems here (but they are solvable).

1. First of all I just ride to evolute the function:
Code:
FourierTransform[Cos[3000 t], t, ω]

I't took a long time so I advice you don't use 3000 but something smaller perhaps 30. Well anyway this is what I got out (when I used A instead of 3000):
Code:
Sqrt[pi/2]*DiracDelta[-A+omega]+Sqrt[pi/2]*DiracDelta[A+omega]

2. Now the first of the real problems becomes visable. The DiracDelta function returns 0 for enything that isn't 0 and "DiracDelta[0]" if it is 0.
That means that it doesn't have a numerical value at A and it therefore can't be ploted at htat point. Now as far as the Fourier transformation goes this all fine but you wanted to see a line there, so let's try to make one. The idea is to replace the DiracDelta with something that can be drawn, I found that DiscreteDelta works just fine for these case. So now the code should look something like this:
Code:
ft=FourierTransform[Cos[3000 t], t, ω]/.DiracDelta->DiscreteDelta

And should evolute to:
Code:
Sqrt[pi/2]*DiscreteDelta[-A+omega]+Sqrt[pi/2]*DiscreteDelta[A+omega]

3. Now you have a function that returns 0 for everything except for A and -A where it returns Sqrt[pi/2]. But if you try to use Plot on it you will still get a streight line at 0. The problem now is in the Plot function works. What the Plot function really does is callculate your function at a number points (I believe there's a default of 25) and connects them with a curve. Well the thing is that these points aren't usually nice (for instance if you evoluted this function
Code:
Plot[Sqrt[-1]*x,{x,1,3},PlotPoints->3]CODE] you would see in the errors that tzhe points it wanted to calculate where: a bit more then 1, something near but not exactly 2 and a bit less then 3). The probleme with ploting your function is that it misses the only point where it's not zero.There is however a way around this.

First make a list of values of your function:
[CODE]values=Table[{omega,ft},{omega,min,max,0.1}]

Witch should evoulte to something like:
Code:
{{min,0},{min+0.1,0},{min+0.2,0},...}

Now you use the ListPlot function:
Code:
ListPlot[values,PlotJoined->True]

This should give you a nice preaty plot. But if you use some strange values for A it might still miss it (I will see if there is enything that can be done about that and some othere smaller problems such as the hight of the peaks(now only Sqrt[pi/2])).
 
  • #3
LENIN said:
This should give you a nice preaty plot. But if you use some strange values for A it might still miss it (I will see if there is enything that can be done about that and some othere smaller problems such as the hight of the peaks(now only Sqrt[pi/2])).

The LENIN's method misses some points as mentioned, because some numbers in omega table are odd. For example,
Code:
0.1+0.2=0.30000000000000004`
This problem can be resolved using Rationalize. The following function works as intended.
Code:
ft[ω_]:=DiscreteDelta[0.3-Rationalize[ω]]
 

1. What is a Fourier Transform and how is it used to solve problems in Mathematica?

A Fourier Transform is a mathematical tool used to decompose a function into its constituent frequencies. In Mathematica, it can be used to analyze and manipulate complex data sets, such as signals and images. It is particularly useful for solving differential equations and optimizing functions.

2. Can you explain the process of using Fourier Transform in Mathematica to solve a problem?

The first step is to import or generate the data set that needs to be analyzed. Then, the Fourier Transform function is applied to the data, which converts it from a time or space domain to a frequency domain. The resulting data can then be manipulated or analyzed using various functions and techniques, and the inverse Fourier Transform can be applied to obtain the original data in the time or space domain.

3. What are the benefits of using Fourier Transform in Mathematica compared to other methods?

One major benefit is the speed and efficiency of Mathematica's built-in Fourier Transform functions, which can handle large data sets with complex frequencies. Additionally, Mathematica offers a wide range of functions and techniques for analyzing and manipulating the transformed data, making it a powerful tool for solving a variety of problems.

4. Are there any limitations or challenges to using Fourier Transform in Mathematica?

One limitation is that the data must be evenly spaced in order for the Fourier Transform to accurately represent the frequency content. This can be a challenge when working with real-world data sets that may have irregular spacing. Additionally, the interpretation of the transformed data can be complex and may require a good understanding of Fourier analysis.

5. Can Fourier Transform in Mathematica be used for real-world applications?

Yes, Fourier Transform is widely used in a variety of fields such as signal processing, image analysis, and data compression. It can be applied to solve real-world problems such as noise reduction, pattern recognition, and data analysis in fields like engineering, finance, and biology.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
238
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Topology and Analysis
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Back
Top