Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Up and Downsampling Matlab

Status
Not open for further replies.

petereumel

Newbie level 1
Joined
Aug 12, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
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(1:parameter-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(1:parameter-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 did not understand your methods for upsampling and downsampling.
Why you dont use direct matlab operators for this: downsample(x,n) and upsample(x,n)?
 

I did not understand your methods for upsampling and downsampling.
Why you dont use direct matlab operators for this: downsample(x,n) and upsample(x,n)?
it's very simple to know. You can use function of Matlab. for example: downsample help .
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top