13. Let $\omega>0$ be a real number, and 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}$. Find the maximum and minimum values of $f(x)$ on $\left[\frac{\pi}{8}, \frac{\pi}{4}\right]$.
$$
\begin{aligned}
f(x) & =\frac{1-\cos 2 \omega x}{2}+\frac{\sqrt{3}}{2} \sin 2 \omega x=\frac{\sqrt{3}}{2} \sin 2 \omega x-\frac{1}{2} \cos 2 \omega x+\frac{1}{2} \\
& =\sin \left(2 \omega x-\frac{\pi}{6}\right)+\frac{1}{2}
\end{aligned}
$$

From the condition, we know $T=\frac{2 \pi}{2 \omega}=\frac{\pi}{2}$, then $\omega=2$.
Thus, $f(x)=\sin \left(4 x-\frac{\pi}{6}\right)+\frac{1}{2}$,
When $\frac{\pi}{8} \leq x \leq \frac{\pi}{4}$, $\frac{\pi}{3} \leq 4 x-\frac{\pi}{6} \leq \frac{5 \pi}{6}$,
Therefore, $\frac{1}{2} \leq \sin \left(4 x-\frac{\pi}{6}\right) \leq 1$, which means $1 \leq \sin \left(4 x-\frac{\pi}{6}\right)+\frac{1}{2} \leq \frac{3}{2}$.

Thus, $f(x)$ reaches its maximum value $\frac{3}{2}$ at $x=\frac{\pi}{6}$, and its minimum value is 1 at $x=\frac{\pi}{4}$.