Convoluting two signals and correcting the time vector

조회 수: 5 (최근 30일)
Friðrik Hover
Friðrik Hover 2016년 2월 21일
답변: Anish Mitra 2016년 2월 24일
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?

답변 (1개)

Anish Mitra
Anish Mitra 2016년 2월 24일
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));

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by