Google search

Saturday, November 14, 2009



PROGRAM:
%program for circular convolution
g=input('enter the first sequence');
h=input('enter the second sequence');
N1=length(g);
N2=length(h);
N=max(N1,N2);
N3=N1-N2;
%loop for getting equal length
if(N3==0)
    h=[h,zeros(1,N3)];
else
    g=[g,zeros(1,-N3)];
        end
        %computation of circular waves
        for n=1:N;
            y(n)=0;
            for i=1:N;
                j=n-i+1;
                if(j==0)
                    j=N+j;
                end
                y(n)=y(n)+g(i)*h(j);
            end
        end
        subplot(3,1,1);
        stem(g);
        ylabel('amplitude-->');
        xlabel('g(n)-->');
        subplot(3,1,2);
        stem(h);
        ylabel('amplitude-->');
        xlabel('h(n)-->');
        subplot(3,1,3);
        stem(y);
        ylabel('amplitude-->');
        xlabel('y(n)-->');
        disp('the resultant signal is:');y

No comments:

Post a Comment