5
$\begingroup$

Consider a continuous signal as follows:

wavesum = 1.6 Cos[t + 0.3] + 30.9 Cos[3 t - 1.5] + 2.8 Cos[7 t + 1.7] + 
          80.1 Cos[5 t + 2.1] + 5.5 Cos[9 t - 2.4];

The Fourier Transform of this will be

cft = Table[{(1/Pi)*
       Integrate[
       wavesum/E^(I*ω*t), {t, -Pi, Pi}], ω}, {ω, 
       1, 10}]; 

Now I extracted the frequency, amplitude and phase components of the constituent signals using the following code:

frequency = DeleteCases[cft, {a_, _} /; Abs[Chop[a]] == 0][[All, 2]];
amplitude = Abs[DeleteCases[cft, {a_, _} /; Abs[Chop[a]] == 0][[All, 1]]];
phase = Arg[DeleteCases[cft, {a_, _} /; Abs[Chop[a]] == 0][[All, 1]]];

and displayed in a table format -

Panel@Grid[
Prepend[Transpose[{frequency, amplitude, phase}], 
Style[#, {Blue, Bold, 12}] & /@ {"Frequency", "Amplitude", 
 "Phase"}], Frame -> All, 
Dividers -> Directive[Gray, Thickness[4]], 
ItemSize -> {Automatic, 2}, 
Background -> {None, {LightGreen, {LightBlue, LightOrange}}}]

and the output is:

Continuous Case

Now I sampled the signal to apply discrete Fourier Transform:

fs = 20;
n = 20;
nl = fs/2;
data = Table[wavesum, {t, 0, 1 - 1/n, 1/n}];

Then performed discrete Fourier Transform:

dft = Table[{Sum[
       data[[r]]/E^(2*Pi*I*(r - 1)*((s - 1)/n)), {r, 1, n}], s}, {s, 1, 
        nl}]; 

And got the frequency, amplitude and phase information -

freq = DeleteCases[dft, {a_, _} /; Abs[Chop[a]] == 0][[All, 2]] - 1;
amp = Abs[DeleteCases[dft, {a_, _} /; Abs[Chop[a]] == 0][[All, 1]]]/
nl;
pha = Arg[DeleteCases[dft, {a_, _} /; Abs[Chop[a]] == 0][[All, 1]]];

And displayed them:

Panel@Grid[
Prepend[Transpose[{freq, amp, pha}], 
 Style[#, {Blue, Bold, 12}] & /@ {"Frequency", "Amplitude", 
 "Phase"}], Frame -> All, 
Dividers -> Directive[Gray, Thickness[4]], 
ItemSize -> {Automatic, 2}, 
Background -> {None, {LightGreen, {LightBlue, LightOrange}}}]

Discrete case 1

However, if I choose the signal in the following format:

y = 1.6 Cos[2 π (t) + 0.3] + 30.9 Cos[2 π (3 t) - 1.5] + 
   2.8 Cos[2 π (7 t) + 1.7] + 80.1 Cos[2 π (5 t) + 2.1] + 
   5.5 Cos[2 π (9 t) - 2.4];

I get the desired result as I got for the continuous case.

What's wrong with my understanding and how can I fix it?

$\endgroup$
1
  • $\begingroup$ I think this problem can be answered by looking closely at mathematica.stackexchange.com/questions/1714/… and the differing definitions of Fourier and FourierTransform. You are performing the fourier transform with your own routines, but I am pretty sure that the $2\pi$ can be found when tracing the math carefully. $\endgroup$
    – ftiaronsem
    Jul 11, 2017 at 14:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.