x = [1 2 3 4]; 
h = [1 2 1 0];

N = max(length(x), length(h));
x = [x, zeros(1, N - length(x))]; 
h = [h, zeros(1, N - length(h))];

X = fft(x); 
H = fft(h); 
Y = X .* H; 
y = ifft(Y); 

disp('Circular Convolution Result:');
disp(y);

figure;
stem(0:N-1, real(y), 'b'); 
title('Circular Convolution'); 
xlabel('n'); ylabel('y[n]');
grid on;

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: