| Filter Design Toolbox | ![]() |
Calculate and return the measured mean-squared error for an adaptive filter
Syntax
Description
mse = msesim(ha,x,d)
returns the sequence of mean-square errors in column vector mse. The vector contains estimates of the mean-square error of the adaptive filter at each time instant during adaptation. The length of mse is equal to size(x,1). The columns of matrix x contain individual input signal sequences, and the columns of the matrix d contain corresponding desired response signal sequences.
[mse,meanw,w,tracek] = msesim(ha,x,d)
calculates three parameters that correspond to the simulated behavior of the adaptive filter defined by ha:
meanw--sequence of coefficient vector means. The columns of this matrix contain estimates of the mean values of the LMS adaptive filter coefficients at each time instant. The dimensions of meanw are (size(x,1))-by-(ha.length).
w--estimate of the final values of the adaptive filter coefficients for the algorithm corresponding to ha.
tracek--sequence of total coefficient error powers. This column vector contains estimates of the total coefficient error power of the LMS adaptive filter at each time instant. The length of tracek is equal to size(X,1).
[mse,meanw,w,tracek] = msesim(ha,x,d,m)
specifies an optional input argument m that is the decimation factor for computing meanw, mse, and tracek. When m > 1, msepsim saves every mth predicted value of each of these sequences. When you omit the optional argument m, it defaults to one.
Examples
Simulation of a 32-coefficient FIR filter using 25 trials, each trial having 2000 iterations of the adaptation process.
x = zeros(2000,25); d = x; % Initialize variables ha = fir1(31,0.5); % FIR system to be identified x = filter(sqrt(0.75),[1 -0.5],sign(randn(size(x)))); n = 0.1*randn(size(x)); % Observation noise signal d = filter(ha,1,x)+n; % Desired signal l = 32; % Filter length mu = 0.008; % LMS Step size. m = 5; % Decimation factor for analysis % and simulation results ha = adaptfilt.lms(l,mu); [simmse,meanWsim,Wsim,traceKsim] = msesim(ha,x,d,m); nn = m:m:size(x,1); subplot(2,1,1); plot(nn,meanWsim(:,12),'b',nn,meanWsim(:,13:15),'b'); title('Average Coefficient Trajectories for W(12), W(13),... W(14) and W(15)'); xlabel('time index'); ylabel('coefficient value'); subplot(2,2,3); semilogy(nn,simmse); title('Mean-Square Error Performance'); axis([0 size(x,1) 0.001 10]); legend('Measured MSE'); xlabel('time index'); ylabel('squared error value'); subplot(2,2,4); semilogy(nn,traceKsim); title('Sum-of-Squared Coefficient Errors'); axis([0 size(x,1) 0.0001 1]); xlabel('time index'); ylabel('squared error value');
See Also
| msepred | nlm | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |