18. Let $f(x), g(x)$ be odd and even functions defined on $R$, respectively, and $f(x)+g(x)=2^{x}$. If for $x \in\left[\frac{1}{2}, 2\right]$, the inequality $a f(x)-f(3 x) \leqslant 2 g(2 x)$ always holds, find the range of the real number $a$.
Solve:
\[
\left\{\begin{array}{l}
f(x)+g(x)=2^{x}, \\
-f(x)+g(x)=2^{-x}
\end{array} \Rightarrow\left\{\begin{array}{l}
f(x)=\frac{2^{x}-2^{-x}}{2}, \\
g(x)=\frac{2^{x}+2^{-x}}{2}
\end{array}\right.\right.
\]
Then \( a f(x)-f(3 x) \leqslant 2 g(2 x) \Rightarrow a\left(2^{x}-2^{-x}\right)-\left(2^{3 x}-2^{-3 x}\right) \leqslant 2\left(2^{2 x}+2^{-2 x}\right) \)
\[
\Rightarrow a\left(2^{x}-2^{-x}\right)-\left[\left(2^{x}-2^{-x}\right)^{3}+3\left(2^{x}-2^{-x}\right)\right] \leqslant 2\left[\left(2^{x}-2^{-x}\right)^{2}+2\right]
\]
\[
\xrightarrow{t=2^{x}-2^{-x} \in\left[\frac{\sqrt{2}}{2}, \frac{15}{4}\right]} a t \leqslant t^{3}+2 t^{2}+3 t+4 \Rightarrow a \leqslant t^{2}+2 t+\frac{4}{t}+3,
\]
Let \( h(t)=t^{2}+2 t+\frac{4}{t}+3, t \in\left[\frac{\sqrt{2}}{2}, \frac{15}{4}\right], h^{\prime}(t)=2 t+2-\frac{4}{t^{2}}=\frac{2\left(t^{3}+t^{2}-2\right)}{t^{2}}=\frac{2(t-1)\left(t^{2}+2 t+2\right)}{t^{2}} \),
Thus \( h(t) \) is monotonically decreasing on \( \left(\frac{\sqrt{2}}{2}, 1\right) \) and monotonically increasing on \( \left(1, \frac{15}{4}\right) \), hence \( h(t)_{\min }=h(1)=10 \). In conclusion, the range of real number \( a \) is \( (-\infty, 10] \).