Weights of LMS adaptives filter: bode commant, plot magnitude and phase
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Dimitris Kalogiros
2018-8-27
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 个评论
Dimitris Kalogiros
2018-8-27
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
更多回答(1 个)
Dimitris Kalogiros
2018-8-27
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adaptive Filters 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!