FIR adaptive filter implementation using LMS/RLS algorithm with DSP system toolbox

6 次查看(过去 30 天)
Hi hello,
I am trying to implement FIR adaptive filter with LMS/RLS algorithm for noise reduction in my acquired ppg signal. The ppg signal is primary input a+b where a is the desired signal not correlated with r (noise reference input of the filter) b is the noise of the signal ppg correlated with r. I am using dsp.LMSFilter, but I am getting exactly same output as the given input signal. I am not sure, if I have used the DSP toolbox functions correctly as well, for which I have attached my code below. I have followed exactly - https://de.mathworks.com/help/dsp/ug/enhance-a-signal-using-lms-and-normalized-lms-algorithms.html
% Read the data
data = readmatrix('U:\1_thesis\work_package_3\log_data_analysis\filtered.csv');
% x - desired ppg signal and v2 - noise ref acc data
x = data(:,1);
v2 = data(:,2);
% setting up the filter
L = 2;
lms = dsp.LMSFilter(L,'Method','LMS');
[mumaxlms,mumaxmselms] = maxstep(lms,x);
lms.StepSize = mumaxmselms/30;
% y1 - filtered signal, elms - error
[y1,elms,wlms] = lms(v2,x);
% total data length is 15002
n = (1:15002)';
% output graph
plot(n(1:1200),[y1(1:1200),elms(1:1200)]);
legend('LMS output signal', 'LMS error');
xlabel('Time index (n)');
ylabel('Amplitude');
hold on;
plot(n(1:1200),x(1:1200),'k:'); %input noisy signal plot
xlabel('Time index (n)');
ylabel('Amplitude');
hold off;
Your help is very much appreciated and Thanks in advance

回答(1 个)

Balaji
Balaji 2023-8-27
Hi Siddarth,
As per my understanding, you have issue while obtaining desired results using “dsp.LMSFilter”. You have correctly implemented the filter, but in order to get better results, decrease the “lms.StepSize” for a small steady state error between the output and the desired signal.
You can refer to the documentation of “dsp.LMSFilter” below:

类别

Help CenterFile Exchange 中查找有关 Adaptive Filters 的更多信息

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by