The mean squared error (MSE) measures the average of the squares of the errors between the desired signal and the primary signal input to the adaptive filter. Reducing this error converges the primary input to the desired signal. Determine the predicted value of MSE and the simulated value of MSE at each time instant using the `msepred`

and `msesim`

functions. Compare these MSE values with each other and with respect to the minimum MSE and steady-state MSE values. In addition, compute the sum of the squares of the coefficient errors given by the trace of the coefficient covariance matrix.

**Note**: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, `obj(x)`

becomes `step(obj,x)`

.

**Initialization**

Create a `dsp.FIRFilter`

System object™ that represents the unknown system. Pass the signal, `x`

*,* to the FIR filter. The output of the unknown system is the desired signal, `d`

, which is the sum of the output of the unknown system (FIR filter) and an additive noise signal, `n`

.

**LMS Filter**

Create a `dsp.LMSFilter`

System object to create a filter that adapts to output the desired signal. Set the length of the adaptive filter to 32 taps, step size to 0.008, and the decimation factor for analysis and simulation to 5. The variable `simmse`

represents the simulated MSE between the output of the unknown system, `d`

, and the output of the adaptive filter. The variable `mse`

gives the corresponding predicted value.

**Plot the MSE Results**

Compare the values of simulated MSE, predicted MSE, minimum MSE, and the final MSE. The final MSE value is given by the sum of minimum MSE and excess MSE.

The predicted MSE follows the same trajectory as the simulated MSE. Both these trajectories converge with the steady-state (final) MSE.

**Plot the Coefficient Trajectories**

`meanWsim`

is the mean value of the simulated coefficients given by `msesim`

. `meanW`

is the mean value of the predicted coefficients given by `msepred`

.

Compare the simulated and predicted mean values of LMS filter coefficients 12,13,14, and 15.

PlotTitle = *2x1 cell*
{'Average Coefficient Trajectories for'}
{'W(12), W(13), W(14), and W(15)' }

In steady state, both the trajectories converge.

**Sum of Squared Coefficient Errors**

Compare the sum of the squared coefficient errors given by `msepred`

and `msesim`

. These values are given by the trace of the coefficient covariance matrix.