Example 3 Let $a_{i}=0,1(i=1,2, \cdots, n)$. Try to find the number of sequences $\left(a_{1}, a_{2}, \cdots, a_{n}\right)$ that satisfy
$$
a_{1} \leqslant a_{2}, a_{2} \geqslant a_{3}, a_{3} \leqslant a_{4}, a_{4} \geqslant a_{5}, \cdots \cdots .
$$
Let $f_{n}$ be the number of sequences that satisfy the condition. Then $f_{1}=2, f_{2}=3, f_{3}=5$.
Let $b_{n}$ be the number of sequences that satisfy the condition when $a_{n}=0$; and $c_{n}$ be the number of sequences that satisfy the condition when $a_{n}=1$.
Then $f_{n}=b_{n}+c_{n}$.
It is easy to see that,
when $n$ is odd, we have $c_{n}=c_{n-1}$, and $b_{n}=f_{n-1}$. When $n$ is even, we have $b_{n}=b_{n-1}$, and $c_{n}=f_{n-1}$. Therefore, when $n$ is odd, we have
$$
f_{n}=b_{n}+c_{n}=f_{n-1}+c_{n-1}=f_{n-1}+f_{n-2} \text {. }
$$

Similarly, when $n$ is even, we also have
$$
f_{n}=f_{n-1}+f_{n-2} \text {. }
$$

Thus, we know that $f_{n}$ is a Fibonacci sequence, and we have
$$
f_{n}=F_{n+2} \text {. }
$$

Therefore, $f_{n}=\frac{1}{\sqrt{5}}\left[\left(\frac{1+\sqrt{5}}{2}\right)^{n+2}-\left(\frac{1-\sqrt{5}}{2}\right)^{n+2}\right]$.