I want to observe how the signal's phase changes over time and I know Hilbert transform can be used here to get the analytic signal, from which I can extract the amplitude and phase.
I know that to get the analytic signal $x_a(t)$ from a continuous-time signal $x(t)$ I need to calculate this:
$$ x_a(t) = x(t) * \mathcal F^{-1}\left\{2\cdot u(w)\right\},$$
where $*$ is the convolution operation, $\mathcal F^{-1}\left\{\cdot\right\}$is the inverse Fourier transform, and $u(w)$ is the Heaviside/unit step function.
$$\mathcal F^{-1}\left\{2 \cdot u(w)\right\} = c_1\cdot \frac{j}{t} + c_2\cdot\delta(t),$$
where $c_1$ and $c_2$ are some constants, $j$ is the square root of $-1$, and $\delta(t) $ is the Dirac delta function.
Now, I want to do this convolution with a discrete-time (sampled) signal.
While implementing the code for this I've discovered that the $\mathcal F^{-1}\left\{u[w]\right\}$ doesn't look at all like $c_1\cdot\frac{j}{t}$ and vice versa $\mathcal F\left\{\frac 1k\right\}$ doesn't look at all like $-j\cdot\operatorname{sign}[w]$.
Specifically, if I calculate $\displaystyle h[k]_{0 \leq k \leq 63}= \frac {2}{\pi\cdot (k-32)}$ for odd $k$, $0$ for even $k$:
[ 0] +0.000000,+0.000000 abs=+0.000000
[ 1] -0.020536,+0.000000 abs=+0.020536
[ 2] +0.000000,+0.000000 abs=+0.000000
[ 3] -0.021952,+0.000000 abs=+0.021952
[ 4] +0.000000,+0.000000 abs=+0.000000
[ 5] -0.023579,+0.000000 abs=+0.023579
[ 6] +0.000000,+0.000000 abs=+0.000000
[ 7] -0.025465,+0.000000 abs=+0.025465
[ 8] +0.000000,+0.000000 abs=+0.000000
[ 9] -0.027679,+0.000000 abs=+0.027679
[10] +0.000000,+0.000000 abs=+0.000000
[11] -0.030315,+0.000000 abs=+0.030315
[12] +0.000000,+0.000000 abs=+0.000000
[13] -0.033506,+0.000000 abs=+0.033506
[14] +0.000000,+0.000000 abs=+0.000000
[15] -0.037448,+0.000000 abs=+0.037448
[16] +0.000000,+0.000000 abs=+0.000000
[17] -0.042441,+0.000000 abs=+0.042441
[18] +0.000000,+0.000000 abs=+0.000000
[19] -0.048971,+0.000000 abs=+0.048971
[20] +0.000000,+0.000000 abs=+0.000000
[21] -0.057875,+0.000000 abs=+0.057875
[22] +0.000000,+0.000000 abs=+0.000000
[23] -0.070736,+0.000000 abs=+0.070736
[24] +0.000000,+0.000000 abs=+0.000000
[25] -0.090946,+0.000000 abs=+0.090946
[26] +0.000000,+0.000000 abs=+0.000000
[27] -0.127324,+0.000000 abs=+0.127324
[28] +0.000000,+0.000000 abs=+0.000000
[29] -0.212207,+0.000000 abs=+0.212207
[30] +0.000000,+0.000000 abs=+0.000000
[31] -0.636620,+0.000000 abs=+0.636620
[32] +0.000000,+0.000000 abs=+0.000000
[33] +0.636620,+0.000000 abs=+0.636620
[34] +0.000000,+0.000000 abs=+0.000000
[35] +0.212207,+0.000000 abs=+0.212207
[36] +0.000000,+0.000000 abs=+0.000000
[37] +0.127324,+0.000000 abs=+0.127324
[38] +0.000000,+0.000000 abs=+0.000000
[39] +0.090946,+0.000000 abs=+0.090946
[40] +0.000000,+0.000000 abs=+0.000000
[41] +0.070736,+0.000000 abs=+0.070736
[42] +0.000000,+0.000000 abs=+0.000000
[43] +0.057875,+0.000000 abs=+0.057875
[44] +0.000000,+0.000000 abs=+0.000000
[45] +0.048971,+0.000000 abs=+0.048971
[46] +0.000000,+0.000000 abs=+0.000000
[47] +0.042441,+0.000000 abs=+0.042441
[48] +0.000000,+0.000000 abs=+0.000000
[49] +0.037448,+0.000000 abs=+0.037448
[50] +0.000000,+0.000000 abs=+0.000000
[51] +0.033506,+0.000000 abs=+0.033506
[52] +0.000000,+0.000000 abs=+0.000000
[53] +0.030315,+0.000000 abs=+0.030315
[54] +0.000000,+0.000000 abs=+0.000000
[55] +0.027679,+0.000000 abs=+0.027679
[56] +0.000000,+0.000000 abs=+0.000000
[57] +0.025465,+0.000000 abs=+0.025465
[58] +0.000000,+0.000000 abs=+0.000000
[59] +0.023579,+0.000000 abs=+0.023579
[60] +0.000000,+0.000000 abs=+0.000000
[61] +0.021952,+0.000000 abs=+0.021952
[62] +0.000000,+0.000000 abs=+0.000000
[63] +0.020536,+0.000000 abs=+0.020536
Then the FFT of this $h[k]$ gives me this:
[ 0] +0.000000,+0.000000 abs=+0.000000
[ 1] +0.000000,+1.179305 abs=+1.179305
[ 2] +0.000000,-0.902170 abs=+0.902170
[ 3] +0.000000,+1.067172 abs=+1.067172
[ 4] +0.000000,-0.948614 abs=+0.948614
[ 5] +0.000000,+1.041888 abs=+1.041888
[ 6] +0.000000,-0.964377 abs=+0.964377
[ 7] +0.000000,+1.031241 abs=+1.031241
[ 8] +0.000000,-0.971946 abs=+0.971946
[ 9] +0.000000,+1.025678 abs=+1.025678
[10] +0.000000,-0.976117 abs=+0.976117
[11] +0.000000,+1.022524 abs=+1.022524
[12] +0.000000,-0.978495 abs=+0.978495
[13] +0.000000,+1.020766 abs=+1.020766
[14] +0.000000,-0.979737 abs=+0.979737
[15] +0.000000,+1.019971 abs=+1.019971
[16] +0.000000,-0.980125 abs=+0.980125
[17] +0.000000,+1.019971 abs=+1.019971
[18] +0.000000,-0.979737 abs=+0.979737
[19] +0.000000,+1.020766 abs=+1.020766
[20] +0.000000,-0.978495 abs=+0.978495
[21] +0.000000,+1.022524 abs=+1.022524
[22] +0.000000,-0.976117 abs=+0.976117
[23] +0.000000,+1.025678 abs=+1.025678
[24] +0.000000,-0.971946 abs=+0.971946
[25] +0.000000,+1.031241 abs=+1.031241
[26] +0.000000,-0.964377 abs=+0.964377
[27] +0.000000,+1.041888 abs=+1.041888
[28] +0.000000,-0.948614 abs=+0.948614
[29] +0.000000,+1.067172 abs=+1.067172
[30] +0.000000,-0.902170 abs=+0.902170
[31] +0.000000,+1.179305 abs=+1.179305
[32] +0.000000,+0.000000 abs=+0.000000
[33] +0.000000,-1.179305 abs=+1.179305
[34] +0.000000,+0.902170 abs=+0.902170
[35] +0.000000,-1.067172 abs=+1.067172
[36] +0.000000,+0.948614 abs=+0.948614
[37] +0.000000,-1.041888 abs=+1.041888
[38] +0.000000,+0.964377 abs=+0.964377
[39] +0.000000,-1.031241 abs=+1.031241
[40] +0.000000,+0.971946 abs=+0.971946
[41] +0.000000,-1.025678 abs=+1.025678
[42] +0.000000,+0.976117 abs=+0.976117
[43] +0.000000,-1.022524 abs=+1.022524
[44] +0.000000,+0.978495 abs=+0.978495
[45] +0.000000,-1.020766 abs=+1.020766
[46] +0.000000,+0.979737 abs=+0.979737
[47] +0.000000,-1.019971 abs=+1.019971
[48] +0.000000,+0.980125 abs=+0.980125
[49] +0.000000,-1.019971 abs=+1.019971
[50] +0.000000,+0.979737 abs=+0.979737
[51] +0.000000,-1.020766 abs=+1.020766
[52] +0.000000,+0.978495 abs=+0.978495
[53] +0.000000,-1.022524 abs=+1.022524
[54] +0.000000,+0.976117 abs=+0.976117
[55] +0.000000,-1.025678 abs=+1.025678
[56] +0.000000,+0.971946 abs=+0.971946
[57] +0.000000,-1.031241 abs=+1.031241
[58] +0.000000,+0.964377 abs=+0.964377
[59] +0.000000,-1.041888 abs=+1.041888
[60] +0.000000,+0.948614 abs=+0.948614
[61] +0.000000,-1.067172 abs=+1.067172
[62] +0.000000,+0.902170 abs=+0.902170
[63] +0.000000,-1.179305 abs=+1.179305
I must be missing some important detail as my math goes against my FFT. What is it?
How to correctly calculate $x_a[k]$ from $x[k]$, what's the proper filter to convolve $x[k]$ with?