13. Given the function
$$
f(x)=\sin ^{2} \omega x+\sqrt{3} \sin \omega x \cdot \sin \left(\omega x+\frac{\pi}{2}\right)
$$

has the smallest positive period of $\frac{\pi}{2}$, where $\omega>0$. Find the maximum and minimum values of $f(x)$ on $\left[\frac{\pi}{8}, \frac{\pi}{4}\right]$.
Three, 13. From the problem, we have
$$
\begin{array}{l}
f(x)=\frac{1-\cos 2 \omega x}{2}+\frac{\sqrt{3}}{2} \sin 2 \omega x \\
=\sin \left(2 \omega x-\frac{\pi}{6}\right)+\frac{1}{2}
\end{array}
$$

Also, $T=\frac{2 \pi}{2 \omega}=\frac{\pi}{2}$, so $\omega=2$. Therefore,
$$
f(x)=\sin \left(4 x-\frac{\pi}{6}\right)+\frac{1}{2} \text {. }
$$

When $\frac{\pi}{8} \leqslant x \leqslant \frac{\pi}{4}$, we have
$$
\begin{array}{l}
\frac{\pi}{3} \leqslant 4 x-\frac{\pi}{6} \leqslant \frac{5 \pi}{6} \\
\Rightarrow \frac{1}{2} \leqslant \sin \left(4 x-\frac{\pi}{6}\right) \leqslant 1 \\
\Rightarrow 1 \leqslant \sin \left(4 x-\frac{\pi}{6}\right)+\frac{1}{2} \leqslant \frac{3}{2} .
\end{array}
$$

Therefore, when $x=\frac{\pi}{6}$, $f(x)$ reaches its maximum value $\frac{3}{2}$; when $x=\frac{\pi}{4}$, $f(x)$ reaches its minimum value 1.