DSP PROGRAM To design a program to compare parallel realization values of IIR digital filter. - Code

Latest

programs

Wednesday, December 7, 2011

DSP PROGRAM To design a program to compare parallel realization values of IIR digital filter.


To design a program to compare parallel realization values of IIR digital filter.

PROGRAM: -

%program for computing direct realisaion values of IIR digital filter
function y=direct(typ,b,a,x);
x=input('enter the input sequence=');
b=input('enter the numberator polynomials');
a=input('enter the denominator polynomials=');
typ=input('type of realisation=');
p=length(a)-1;
q=length(b)-1;
pq=max(p,q);
a=a(2:p+1);
u=zeros(1,pq);%u is the internal state;
if(typ==1)
for i=1:length(x),
unew=x(i)-sum(u(1:p).*a);
u=[unew,u];
y(i)=sum(u(1:q+1).*b);
u=u(1:pq)
end
elseif(typ==2)
    for i=1:length(x)
        y(i)=b(1)*x(i)+u(1);
        u=u((2:pq),0);
        u(1:q)=u(1:q)+b(2:q+1)*x(i);
        u(1:p)=u(1:p)-a*y(i);
    end
end

No comments:

Post a Comment