![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194329/image.jpeg)
Weights of LMS adaptives filter: bode commant, plot magnitude and phase
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Eloy Pena Asensio
am 27 Aug. 2018
Kommentiert: Dimitris Kalogiros
am 27 Aug. 2018
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
0 Kommentare
Akzeptierte Antwort
Dimitris Kalogiros
am 27 Aug. 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194329/image.jpeg)
2 Kommentare
Dimitris Kalogiros
am 27 Aug. 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
Weitere Antworten (1)
Dimitris Kalogiros
am 27 Aug. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!