Example 3 Given that the solution set of $f(\cos x) \geqslant 0$ is $\left[0, \frac{\pi}{2}\right]$, solve the inequality $f(\sin x) \geqslant 0$.

 untranslated text remains unchanged.
Let $x=2 k \pi+\frac{\pi}{2} \pm t, k \in \mathbf{Z}$, then
$$
f(\sin x)=f\left[\sin \left(2 k \pi+\frac{\pi}{2} \pm t\right)\right]=f(\cos t) \geqslant 0
$$

From the given, we have $0 \leqslant t \leqslant \frac{\pi}{2}$,
thus $\quad 2 k \pi+\frac{\pi}{2} \leqslant x \leqslant 2 k \pi+\pi$.
or $2 k \pi \leqslant x \leqslant 2 k \pi+\frac{\pi}{2} \quad(k \in \mathbf{Z})$.
Therefore, $2 k \pi \leqslant x \leqslant 2 k \pi+\pi \quad(k \in \mathbf{Z})$.