- #1

- 299

- 1

Code:

```
f1[t_] := Cos[w t + d1]; f2[t_] := Cos[w t + d2];
data1 = Table[f1[t], {t,1,10000}]; data2 = Table[f2[t], {t,1,10000}];
ft1 = Fourier[data1]; ft2 = Fourier[data2];
```

- Mathematica
- Thread starter NeoDevin
- Start date

- #1

- 299

- 1

Code:

```
f1[t_] := Cos[w t + d1]; f2[t_] := Cos[w t + d2];
data1 = Table[f1[t], {t,1,10000}]; data2 = Table[f2[t], {t,1,10000}];
ft1 = Fourier[data1]; ft2 = Fourier[data2];
```

- #2

berkeman

Mentor

- 58,781

- 8,904

I'm not sure I understand what you are wanting to do. Are you trying to get some information about the phase shifts in the initial datasets after you take a Fourier transform of the datasets? Seems like a standard FT would not preserve that information...

- #3

- 299

- 1

- #4

berkeman

Mentor

- 58,781

- 8,904

- #5

- 299

- 1

- #6

berkeman

Mentor

- 58,781

- 8,904

Magnitudes don't help with phase information. Look at the Re and Im components at the dominant frequency, and compare those to the phase shift in your original data. Do the Re and Im components correspond to the original phase shift? Like, if you put in a 45 degree phase shift (PI/4) in the original sine wave data, do you get an FT where the complex components at that frequency show the PI/4 phase shift from Re to Im (or whichever direction it rotates)?

- #7

- 2,226

- 9

[tex] f_1(t) = \cos(\omega t + d_1) [/tex]

(why not set

[tex] g_1(t) = \sin(\omega t + d_1) [/tex]

now, if you

[tex] A = \sum_n f_1[n] f_2[n] w[n] [/tex]

[tex] B = \sum_n g_1[n] f_2[n] w[n] [/tex]

where w[

[tex] d_2-d_1 = \arg\{A+iB\} = \arctan\left( \frac{B}{A} \right) [/tex]

the latter equality is true only if

- #8

- 30,675

- 7,248

ListCorrelate[data1,data2,1]

will give you a list with peaks at the locations corresponding to the shifts required to "match" the two signals.

- #9

- 299

- 1

From my experimentation, your method gives [itex]d_1 - d_2[/itex], but other than that, it's perfect, thanks.

If we generalize it a little, so that

[tex]f_1(t) = a_1\cos(\omega t + d_1)[/tex]

[tex]f_2(t) = a_2\cos(\omega t + d_2)[/tex]

Is there a way to get the relative amplitude [itex]a_1/a_2[/itex] from this method?

- #10

- 2,226

- 9

yeah, other than the fact that it was meant to work inrbj,

From my experimentation, your method gives [itex]d_1 - d_2[/itex], but other than that, it's perfect, thanks.

the same simple way you would measure magnitude gain of a filter. rectify, smooth, and divide. or you can square, smooth, divide, and square root. or you can Hilbert transform both. for each quadrature pair, square each and add, no need to smooth, divide, and square root. i dunno.If we generalize it a little, so that

[tex]f_1(t) = a_1\cos(\omega t + d_1)[/tex]

[tex]f_2(t) = a_2\cos(\omega t + d_2)[/tex]

Is there a way to get the relative amplitude [itex]a_1/a_2[/itex] from this method?

- Replies
- 9

- Views
- 8K

- Replies
- 4

- Views
- 5K

- Last Post

- Replies
- 2

- Views
- 490

- Replies
- 2

- Views
- 8K

- Replies
- 0

- Views
- 2K

- Replies
- 1

- Views
- 2K

- Replies
- 3

- Views
- 6K

- Last Post

- Replies
- 0

- Views
- 1K

- Replies
- 13

- Views
- 5K

- Replies
- 0

- Views
- 1K