Graph 1 -> signal A
Graph 2 -> signal B
Graph 3 -> convolution of A and B
The code :
clear all;
x = [0 0 -1 2 3 -2 0 1 0 0];
dtx = -2:7; % non-zero range of x
y = [1 -1 2 4];
dty = 8:11; % non-zero range of y
z = conv(x,y);
dtz = 6:18; % non-zero range of z
% plotting
dt = -2:20;
subplot(311);stem(dt,[x zeros(size(8:20))]);
title('Signal A');
subplot(312);stem(dt,[zeros(size(-2:7)) ...
y zeros(size(12:20))]);
title('Signal B');
subplot(313);stem(dt,[zeros(size(-2:5)) ...
z zeros(size(19:20))]);
title('A * B');
I use the example from here, at page 3.

No comments:
Post a Comment