How do I add zero padding to this convolution?
12 ビュー (過去 30 日間)
古いコメントを表示
% My question is how do I add zero padding to this plot? I'm trying to show the effects of circular convolution with and without zero padding.
% This part is taking fourier transform of two different functions
a = 0.5;
n = [0,1,2,3,4,5,6,7];
x1 = a.^n;
x2 = [1,1,1,1,1,1,0,0];
X1 = fft(x1,16);
X2 = fft(x2,16);
% Here is the convolution of them. Need to add zero padding for this
% convolution plot
X1X2 = X1.*X2;
x1x2_conv = ifft(X1X2);
0 件のコメント
採用された回答
Matt J
2021 年 10 月 18 日
編集済み: Matt J
2021 年 10 月 18 日
Not sure what the question is, but you can easily compare your result to direct convolution to see if it's correct.
x1x2_conv = ifft(X1X2)
conv(x1,x2)
2 件のコメント
Matt J
2021 年 10 月 18 日
You have applied zero padding. To omit zero padding,
X1 = fft(x1);
X2 = fft(x2);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!