# 6.7: Numerical Experiment (Frequency Response of First-Order Filter)


Consider the exponential moving average filter

$$x_{n}=\sum_{k=0}^{\infty} a^{k} u_{n-k ;} \quad a=0.98$$

1. Write out a few terms of the sum to show how the filter works.
2. Write $$x_n$$ as a recursion and discuss the computer memory required to implement the filter.
3. Compute the complex frequency response $$H(e^{j\theta})$$ for the filter
4. Write a MATLAB program to plot the magnitude and phase of the complex frequency response $$H(e^{j\theta})$$ versus $$\theta$$ for $$\theta =−\pi$$ to $$+\pi$$ in steps of $$\frac{2\pi}{64}$$ Do this for two values of $$a$$, namely, $$a=0.98$$ and $$a=-0.98$$. Explain your findings.
5. Write a MATLAB program to pass the following signals through the filter when $$a=0.98$$:
1. $$u_{n}=\delta_{n}$$
2. $$u_{n}=\xi_{n}$$
3. $$u_{n}=\xi_{n} \cos \frac{2 \pi}{64} n$$
4. $$u_{n}=\xi_{n} \cos \frac{2 \pi}{32} n$$
5. $$u_{n}=\xi_{n} \cos \frac{2 \pi}{16} n$$
6. $$u_{n}=\xi_{n} \cos \frac{2 \pi}{8} n$$
7. $$u_{n}=\xi_{n} \cos \frac{2 \pi}{4} n$$
8. $$u_{n}=\xi_{n} \cos \frac{2 \pi}{2} n$$

Plot the outputs for each case and interpret your findings in terms of the complex frequency response $$H(e^{j\theta})$$. Repeat step 5 for $$a=-0.98$$. Interpret your findings.

This page titled 6.7: Numerical Experiment (Frequency Response of First-Order Filter) is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Louis Scharf (OpenStax CNX) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.