I wrote Mathematica FFT code that works for non-beat signals, eg. Sin[2*Pi/20*x] and more complicated but I can't obtain beat frequency of Sin[2*Pi*(10)*x] + Sin[2*Pi*(11)*x]. Also, what is general approach for sampling of analytical functions or numerical data in order to extract beat freq, because I think there lies the problem? I understand that Nyquist theorem determines appropriate sampling frequency in order to extract high frequencies.
Code:
test[x_] = Sin[2*Pi/20*x] xi = 0 xf = 100 h = 1;(*(xf-xi)/n step*) n = (xf - xi)/h (*# of sampling points*) N[(1/h)/(n)] (*sampling frequency*) xg = N[Range[xi, xf - h, h]]; data = Map[test, xg] cc = Abs[Fourier[data]] ccred = Table[If[0 < i < Length[cc]/2, cc[[i]], 0.], {i, Length[cc]}]; Table[Ordering[ccred, -15][[i]], {i, 15}] Table[ccred[[Ordering[ccred, -15][[i]]]], {i, 15}] nu = Table[N[((Ordering[ccred, -15][[i]] - 1)*(1/h)/(n))], {i, 15}] T = Table[N[1/((Ordering[ccred, -15][[i]] - 1)*(1/h)/(n))], {i, 15}]