Convoluting two signals and correcting the time vector
5 views (last 30 days)
Show older comments
n = -10:10; h3 = gauspuls(n-6); x1 = [1 1 1 0 0 0 0 0 0 0 0] conv(h3,x1) % Convoluting these two signals should only shift the x1 signal 6 steps to the right but I get a vector with 31 numbers and the shift of x1 is 17 steps to the right. How can I correct this?
0 Comments
Answers (1)
Anish Mitra
on 24 Feb 2016
Since the pulse signal, 'h3', is generated with a time range of -10:10, the output actually starts from n = -10. Hence the shift of 17 is actually a shift of 6.
n = 0:10;
h3 = gauspuls(n-6);
x1 = [1 1 1 0 0 0 0 0 0 0 0];
y = conv(h3,x1);
figure;
subplot(3,1,1);
stem(n,x1);
subplot(3,1,2);
stem(n,h3);
subplot(3,1,3);
stem(n,y(1:11));
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!