Coefficients are 'NaN' while using dsp.LMSFilter
Show older comments
Hi, I am new to this field. Please help me in using LMS functions.
I have two sets of data.
data1 - signal+noise (data samples acquired from arduino)
data2 - noise (samples acquired from arduino)
I want to use LMS algorithm to remove the artifacts in data1. I have replaced the random data from LMS link example with my data.
But it returns 'NaN' for all [y,e,w] coefficients.
Why is that ? Is the input value range too high ? Are there any limitations to use this function?
I use MATLAB R2013a version.
signal = data1(:); % 5120x1 matrix ; minValue=0 ; maxValue=600
noise = data2(:); % 5120x1 matrix ; minValue=0 ; maxValue=900
L=length(signal);
nfilt = fir1(10,0.018); % lowpass filter
coeffs = nfilt.' -0.1;
fnoise = filter(nfilt,1,noise);
d = signal + fnoise;
mu = 0.1; % Set the step size for algorithm updating.
lms = dsp.LMSFilter(11,'Method','LMS','StepSize',mu,'InitialConditions',coeffs)
[y,e,w] = step(lms,noise,d);
figure()
plot(0:L-1,d(1:L,:),0:L-1,signal(1:L,:),0:L-1,e(1:L,:));
title('Noise Cancellation by the Sign-Data Algorithm');
legend('added noise Data','Actual signal','Result of Noise Cancellation','Location','NorthEast');
Answers (0)
Categories
Find more on Adaptive Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!