Thread: FT's in Mathematica View Single Post
 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 lets 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 belive theres 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])).