MATLAB code for Circular Convolution using Matrix method

% circular convolution using matrix method %clc;x=[1,2,3,1];h=[4,3,2,2];H=zeros(0);h_index=1;N=length(x);y=zeros(0);disp('x(n)=');disp(x);disp('h(n)=');disp(h);subplot(4,1,1);stem(x);title('Signal One : x(n) ');subplot(4,1,2);stem(h);title('Signal Two : h(n)');temp=0;for i=1:NH(i,1)=h(i);end;for i=2:N    h=circshift(h, [0,1]);    for j=1:N     H(j,i)= h(j);   end;end;disp('H =>>');disp(H);for i=1:N    for j=1:N        temp=temp+H(i,j)*x(j);    end;    y(i)=temp;    temp=0;end;disp('Circular Convolution : y(m)==>');disp(y);subplot(4,1,3);stem(y);title('Circular Convolution: y(m)');

 

Output:

Comments

Popular posts from this blog

Positive number pipe in angular 2+