5. Find the minimum value of the function
$$
f(x)=\sqrt{15-12 \cos x}+\sqrt{4-2 \sqrt{3} \sin x}+\sqrt{7-4 \sqrt{3} \sin x}+\sqrt{10-4 \sqrt{3} \sin x-6 \cos x}
$$
$$
\begin{array}{l}
f_{2}(x)=\sqrt{4-2 \sqrt{3} \sin x}=\sqrt{(\sqrt{3} \cos x-0)^{2}+(\sqrt{3} \sin x-1)^{2}}=|C M|, \\
f_{3}(x)=\sqrt{7-4 \sqrt{3}} \sin x=\sqrt{(\sqrt{3} \cos x-0)^{2}+(\sqrt{3} \sin x-2)^{2}}=|B M|, \\
f_{4}(x)=\sqrt{10-4 \sqrt{3} \sin x-6 \cos x}=\sqrt{(\sqrt{3} \cos x-\sqrt{3})^{2}+(\sqrt{3} \sin x-2)^{2}}=|D M|, \\
\end{array}
$$

where $M(\sqrt{3} \cos x, \sqrt{3} \sin x), A(2 \sqrt{3}, 0), B(0,2), C(0,1), D(\sqrt{3}, 2)$. Point $M$ is on the circle centered at the origin with radius $\sqrt{3}$, given by the equation $x^{2}+y^{2}=3$. The equation of line $A B$ is $\sqrt{3} x+3 y-6=0$, and the equation of line $C D$ is $\sqrt{3} x-3 y+3=0$. Using the point-to-line distance formula, the distance from point $O$ to line $A B$ is $\sqrt{3}$, indicating that $A B$ is tangent to the circle, with the point of tangency $M_{0}\left(\frac{\sqrt{3}}{2}, \frac{3}{2}\right)$. Since $M_{0}$ lies on line $C D$, we have $|A M|+|B M| \geqslant\left|A M_{0}\right|+\left|B M_{0}\right|=|A B|=$ $P_{1}(-2,4)$ or $P_{2}(1,1)$, meaning that when $x=-2$ or $x=1$, the function reaches its minimum value of $\frac{9}{2} \sqrt{2}$.