How to do a convolution for n samples starting from n=0 ?

3 次查看(过去 30 天)
Hi guys,
My question can be a little bit stupid but im trying to figure it out why the answer of my convolution isn't working. The results should appear in the n=0 and this is not what im getting.
Can someone tell me how can i solve it?
The sequence is:
x=[-1 0 1]
h= [0.5 0.25 0.125] ->(version not flipped by the way)
i should get for n=0 ==> -0.5
Cheers!
  2 个评论
Image Analyst
Image Analyst 2017-9-10
编辑:Image Analyst 2017-9-10
If n is the number of samples, as you said, then what does it mean when you say n=0? Zero samples????
Jose Marques
Jose Marques 2017-9-10
n is not the number of samples. In discrete convolution, n is a array index.

请先登录,再进行评论。

采纳的回答

Jose Marques
Jose Marques 2017-9-9
Hello Jucimar. You can try this:
x = [-1 0 1];
h = [0.5 0.25 0 0.125];
w = conv(x,h)
w =
Columns 1 through 5
-0.5000 -0.2500 0.5000 0.1250 0
Column 6
0.1250
  4 个评论
Jose Marques
Jose Marques 2017-9-9
You can generate a array n:
x = [-1 0 1];
h = [0.5 0.25 0 0.125];
n = 0:5;
w = conv(x,h)
plot(n,w)
Try this.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by