Borrar filtros
Borrar filtros

Weights of LMS adaptives filter: bode commant, plot magnitude and phase

2 visualizaciones (últimos 30 días)
Hello, I would like to know if there is a way to plot the magnitude and the phase of the values of the weights returned by LMS adapative filter.
By the way: is there any way to convert this filter to transfer function?
w =
-0.1229
-0.0786
-0.0391
-0.0043
0.0284
0.0594
0.0913
0.1247
0.1620
0.2035
0.2515

Respuesta aceptada

Dimitris Kalogiros
Dimitris Kalogiros el 27 de Ag. de 2018
A very useful script for your case:
clear; clc; close all;
% LMS weights
w=[ -0.1229 -0.0786 -0.0391 -0.0043 0.0284 0.0594...
0.0913 0.1247 0.1620 0.2035 0.2515 ];
%sampling period of our system;
Ts=1;
% LMS feedforward is a filter
sys=tf(w, 1, Ts, 'variable','z^-1');
% plot bode diagram
figure;
bode(sys);
grid on; zoom on;
If you run the script, you will receive bode diagram:
  2 comentarios
Eloy Pena Asensio
Eloy Pena Asensio el 27 de Ag. de 2018
Editada: Eloy Pena Asensio el 27 de Ag. de 2018
Thank you very much! What about my second question?
Is there any way to transform transfer function into a filter?
Dimitris Kalogiros
Dimitris Kalogiros el 27 de Ag. de 2018
Mapping transfer function to filter coefficients is not an easy task, but it is feasible. If I find some time , later on night I will give you an example

Iniciar sesión para comentar.

Más respuestas (1)

Dimitris Kalogiros
Dimitris Kalogiros el 27 de Ag. de 2018
Here you are a more complete script:
clear; clc; close all;
%%problem definition
% LMS weights
w=[ -0.1229 -0.0786 -0.0391 -0.0043 0.0284 0.0594...
0.0913 0.1247 0.1620 0.2035 0.2515 ];
%sampling period of out system;
Ts=1;
%%analyse LMS taps
% magnitude and phase of taps
tap.magn=abs(w);
tap.phase=atan2(imag(w),real(w));
figure;
subplot(2,2,1); stem(tap.magn, '-b*'); title('magnitude of taps');
ylabel('magnitude'); xlabel('tap number'); zoom on; grid on;
subplot(2,2,2); plot(log10(tap.magn), '-b.'); title('magnitude of taps expressed at dB');
ylabel('dB'); xlabel('tap number'); zoom on; grid on;
subplot(2,1,2); plot(tap.phase, '-ro'); title('phase of taps');
xlabel('rand'); ylabel('tap number'); zoom on; grid on;
% LMS feedforward is a filter. Find its frequency response
sys=tf(w, 1, Ts, 'variable','z^-1');
% plot bode diagram
figure;
bode(sys);
grid on; zoom on;
Keep in mind that your LMS coefficients are real numbers, so seeking "magnitude" and "phase" of these values is something with low importance

Community Treasure Hunt

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

Start Hunting!

Translated by