blob: fc59af2a476dc3c22b69bc4a29d02c84e8052c4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
//Example 2.29,Convolution using Tabular method.
clear;
clc;
x=[-2 0 1 -1 3];
h=[1 2 0 -1];
q=length(x);
w=length(h);
z=q+w-1;
y0=0;
for i=1:z;
y(i)=0;
for k=1:i;
if k>q
x(k)=0;
else
if (i-k+1)>w
h(i-k+1)=0;
else
y(i)= y(i) + x(k)*h(i-k+1);
end
end
end
end
disp(y','The Convolution of the two sequences is =')
|