petereumel
Newbie level 1
Hello Guys,
i got a little problem. I want to implement the folloing block-diagramm.
https://www.mikrocontroller.net/attachment/149695/block.jpg
I know how to up and downsample. In the downsampling part i have to filter the signal through a lowpass filter and take every second value. In the upsampling part i have to copy the previus value between the previous and next value. In brackets is my idea where i have to up and downsample. Maybe my idea where i have to up and downsample is wrong.
The LMS code is the following one
for i=1:length(x_ref);
[Downsample]
eingang=[x_ref(i,1);eingang(1arameter-1)];
y(i)=w_voll*eingang;
[Upsample]
e(i)=y(i)+d(i);
[Downsample]
w_voll=w_voll-(mu*e(i)*eingang)';
end
My idea of the implementation:
[Initializations]
d=filter_frd(xi,P13,20,12000);
x_ref=filter_frd(xi,S3,20,12000);
w_para=zeros(1,parameter);
eingang=zeros(parameter,1);
y=zeros(1,length(nSamp));
e=zeros(1,length(nSamp));
v_parallel=filter(Wbmend,1,x_ref);
d_new=v_parallel+d;
filt = fdesign.lowpass('N,Fc',6,10000,40000);
Hd = design(filt);
mu=0.09;
y(1)=0;e(1)=0;
[here starts the LMS with up and downsample, this part has to be wrong]
for i=2:length(x_ref);
if(mod(i,2)~=0)
[ Upsampling ]
y(i)=y(i-1);
y_up(i)=filter(Hd,y(i));
e(i)=y_up(i)+d_neu(i);
[ only take every second value because of downsample]
else
x_ref_do(i,1)=filter(Hd,x_ref(i));
eingang=[x_ref_do(i,1);eingang(1arameter-1)];
y(i)=w_para*eingang;
[ Upsample because the addition has to be with the full length of signal]
y_up(i)=filter(Hd,y(i));
e(i)=y_up(i)+d_neu(i);
w_para=w_para-(mu*e(i)*eingang)';
end
end
The problem is that the lms converges very slow. I think this is a problem with the lowpass. And the second is that the result of the lms is every time the same, doesnt matter if i change the value of mu.
I am very happy about a little help and ideas!
i got a little problem. I want to implement the folloing block-diagramm.
https://www.mikrocontroller.net/attachment/149695/block.jpg
I know how to up and downsample. In the downsampling part i have to filter the signal through a lowpass filter and take every second value. In the upsampling part i have to copy the previus value between the previous and next value. In brackets is my idea where i have to up and downsample. Maybe my idea where i have to up and downsample is wrong.
The LMS code is the following one
for i=1:length(x_ref);
[Downsample]
eingang=[x_ref(i,1);eingang(1arameter-1)];
y(i)=w_voll*eingang;
[Upsample]
e(i)=y(i)+d(i);
[Downsample]
w_voll=w_voll-(mu*e(i)*eingang)';
end
My idea of the implementation:
[Initializations]
d=filter_frd(xi,P13,20,12000);
x_ref=filter_frd(xi,S3,20,12000);
w_para=zeros(1,parameter);
eingang=zeros(parameter,1);
y=zeros(1,length(nSamp));
e=zeros(1,length(nSamp));
v_parallel=filter(Wbmend,1,x_ref);
d_new=v_parallel+d;
filt = fdesign.lowpass('N,Fc',6,10000,40000);
Hd = design(filt);
mu=0.09;
y(1)=0;e(1)=0;
[here starts the LMS with up and downsample, this part has to be wrong]
for i=2:length(x_ref);
if(mod(i,2)~=0)
[ Upsampling ]
y(i)=y(i-1);
y_up(i)=filter(Hd,y(i));
e(i)=y_up(i)+d_neu(i);
[ only take every second value because of downsample]
else
x_ref_do(i,1)=filter(Hd,x_ref(i));
eingang=[x_ref_do(i,1);eingang(1arameter-1)];
y(i)=w_para*eingang;
[ Upsample because the addition has to be with the full length of signal]
y_up(i)=filter(Hd,y(i));
e(i)=y_up(i)+d_neu(i);
w_para=w_para-(mu*e(i)*eingang)';
end
end
The problem is that the lms converges very slow. I think this is a problem with the lowpass. And the second is that the result of the lms is every time the same, doesnt matter if i change the value of mu.
I am very happy about a little help and ideas!