m (New page: See Aperiodic Convolution === Formula for Periodic Convolution === <math> \begin{align} y[n] &= h[n]\circledast x[n]\\ &= \sum_{m=0}^{N-1}h[(n-m) \bmod N]x[m]\\ \end{align} </math>) |
m |
||
(4 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
\end{align} | \end{align} | ||
</math> | </math> | ||
+ | |||
+ | === Basic Algorithm in MATLAB === | ||
+ | |||
+ | <source lang="matlab" enclose="div"> | ||
+ | x1 = [1 1 1 1 0 0 0 0 0 0 0 0]; | ||
+ | x2 = [3 2 1 0 -1 -2 -3 -2 -1 0 1 2]; | ||
+ | |||
+ | N = length(x1); | ||
+ | c = zeros(1,N); | ||
+ | |||
+ | for n = 0:N-1 | ||
+ | csum = 0; | ||
+ | for m = 0:N-1 | ||
+ | csum = csum + x1(mod((n-m),N)+1)*x2(m+1); | ||
+ | end | ||
+ | c(n+1) = csum; | ||
+ | end | ||
+ | </source> | ||
+ | |||
+ | [[Category:ECE438]] |
Latest revision as of 09:51, 7 March 2008
See Aperiodic Convolution_Old Kiwi
Formula for Periodic Convolution
$ \begin{align} y[n] &= h[n]\circledast x[n]\\ &= \sum_{m=0}^{N-1}h[(n-m) \bmod N]x[m]\\ \end{align} $
Basic Algorithm in MATLAB
x1 = [1 1 1 1 0 0 0 0 0 0 0 0];
x2 = [3 2 1 0 -1 -2 -3 -2 -1 0 1 2];
N = length(x1);
c = zeros(1,N);
for n = 0:N-1
csum = 0;
for m = 0:N-1
csum = csum + x1(mod((n-m),N)+1)*x2(m+1);
end
c(n+1) = csum;
end
x2 = [3 2 1 0 -1 -2 -3 -2 -1 0 1 2];
N = length(x1);
c = zeros(1,N);
for n = 0:N-1
csum = 0;
for m = 0:N-1
csum = csum + x1(mod((n-m),N)+1)*x2(m+1);
end
c(n+1) = csum;
end