Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

help, convert matlab program to vhdl coding

Status
Not open for further replies.

richardgda

Newbie level 4
Joined
Feb 8, 2006
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
hi,
i have matlab program for dwt.i don't know how to convert this into vhdl coding.if u have any idea please reply me.
-------------------------------------------------------------------
clear all;
x=input('Enter the input signal ');
lh=input('Enter the filter coeff ');
b=length(lh);
hh=[zeros(1,b)];
for i = 0 : b-1
hh(b-i)=lh(i+1);
if(mod((i+1),2) == 0)
hh(b-i)=(-1)*hh(b-i);
end;
end;
disp(hh);
ly=sampconv1(x,lh);
hy=sampconv1(x,hh);
subplot(3,2,1);plot(x);
subplot(3,2,2);plot(lh);
subplot(3,2,3);plot(hh);
subplot(3,2,4);plot(ly);
subplot(3,2,5);plot(hy);

function s = sampconv1(x,h)
a=length(x);
b=length(h);
N=a+b-1;
x=[x,zeros(1,N-a)];
h=[h,zeros(1,N-b)];
y=[zeros(1,N)];
s=[zeros(1,N/2)];
for i = 1:N
for k=1:i
y(i)=y(i)+x(k)*h(i-k+1);
end;
end;
for i=1:(N/2)
s(i)=y(2*i-1);
end;
disp(y);
disp(s);
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top