Creating Bode Plot from Experimental Data
Assuming you have an input signal $ u = A cos(2\pi ft) $ and you measure an output signal
$y = B cos(2\pi ft + \theta) $
The $\frac{B}{A}$ ratio is the gain and $\theta$ is the phase shift for frequency $f$.
You could simply demodulate $y$ by multiplying by $x = cos(2\pi ft) - jsin(2\pi ft)$
$$ z(t) = y*x = \frac{B}{2}(cos(4\pi ft) + cos(\theta) + j(sin(4\pi ft) + sin(\theta))$$
Now simply compute the  average of $z(t)$ over multiple cycles so that the $cos(4\pi ft)$ and $sin(4\pi ft)$ terms will average to 0.
Divide the magnitude of $z_{mean}$ by $A$ to get the gain and compute the angle of $z_{mean}$ to get the phase shift.
The advantage of this method is that by averaging over multiple cycles, you will significantly reduce the noise and improve the accuracy of your phase and gain estimates. Apply this technique for multiple frequencies, you will get your Bode plot.