m
m
Line 10: Line 10:
  
 
=== Basic Algorithm in MATLAB ===
 
=== Basic Algorithm in MATLAB ===
<source lang="matlab">
+
<source lang="matlab" line="true" enclose="div">
 
x1 = [1 1 1 1 0 0 0 0 0 0 0 0];
 
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];
 
x2 = [3 2 1 0 -1 -2 -3 -2 -1 0 1 2];

Revision as of 11:25, 5 March 2008

See Aperiodic Convolution_OldKiwi

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

  1. x1 = [1 1 1 1 0 0 0 0 0 0 0 0];
  2. x2 = [3 2 1 0 -1 -2 -3 -2 -1 0 1 2];
  3.  
  4. N = length(x1);
  5. c = zeros(1,N);
  6.  
  7. for n = 0:N-1
  8. csum = 0;
  9. for m = 0:N-1
  10. csum = csum + x1(mod((n-m),N)+1)*x2(m+1);
  11. end
  12. c(n+1) = csum;
  13. end

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood