(New page: == CODE SHOWN BELOW: == ''clc; close all; clear all; x1 = input('Please enter the x(t) vector with brackets: '); x2 = input('Please enter the h(t) vector with brackets: '); length_x1=...)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== CODE SHOWN BELOW: ==
+
== CODE ==
 
+
[[Media:Convolution2.pdf]]
 
+
''clc;
+
close all;
+
clear all;
+
 
+
x1 = input('Please enter the x(t) vector with brackets: ');
+
 
+
x2 = input('Please enter the h(t) vector with brackets: ');
+
 
+
length_x1=length(x1);
+
 
+
length_x2=length(x2);
+
 
+
X1=[x1,zeros(1,length(x1))];
+
 
+
X2=[x2,zeros(1,length(x2))];
+
 
+
    for a=1:length_x1+length_x2-1
+
        y(a)=0;
+
      for b=1:length_x1
+
          if(a-b+1>0)
+
            y(a)=y(a)+X1(b)*X2(a-b+1);
+
          else
+
          end
+
      end
+
    end
+
   
+
fprintf('This give us the output:'); y''
+
 
+
  
 
== COMPARISON ==
 
== COMPARISON ==
Matlab's "conv" function works in a similar fashion to the above code.
+
Matlab's "conv" function works in a similar fashion to the above code.  However, it must be noted that both methods do not take into account the variations in starting time of the resulting convolution.

Latest revision as of 13:07, 1 July 2009

CODE

Media:Convolution2.pdf

COMPARISON

Matlab's "conv" function works in a similar fashion to the above code. However, it must be noted that both methods do not take into account the variations in starting time of the resulting convolution.

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn