From: Simon on
Hi - I have a problem with conv.

I have two real-functions given as arrays y1 and y2, with corresponding x-values x1, x2 (so that plot(x1,y1) would plot y1 with the proper x-axis). The length of y1 and y2 is n and m and need not be the same.

I wish to convolute y1 and y2, so
c1=conv(y1,y2).
Now length(c1) = n+m-1;

The question is what is the prober x to use in plotting c1?

I realize I can also use
c1=conv(y1,y2,'same')

In which case length(c1) = length(y1), but is x1 the right x-values in this case?

Thanks
Simon
From: Rune Allnor on
On 1 Feb, 14:23, "Simon " <s...(a)fys.ku.dk> wrote:
> Hi - I have a problem with conv.
>
> I have two real-functions given as arrays y1 and y2, with corresponding x-values x1, x2 (so that plot(x1,y1) would plot y1 with the proper x-axis). The length of y1 and y2 is n and m and need not be the same.
>
> I wish to convolute y1 and y2, so
> c1=conv(y1,y2).
> Now length(c1) = n+m-1;
>
> The question is what is the prober x to use in plotting c1?
>
> I realize I can also use
> c1=conv(y1,y2,'same')
>
> In which case length(c1) = length(y1), but is x1 the right x-values in this case?

That's up to you to decide.

CONV just computes the convolution sum formula, in the
simplest way possible. To do that, certain default
assumptions are used, i.e. that the vectors are indexed
from 1 to their respective lengths.

It is perfectly possible that the data domain requires the
N-length vector to be indexed e.g from -N to -1, or from -2
to N-3. If this is the case, it fill be up to you as
user to make sure that the indexes for the resulting data
are adjusted correspondingly.

Rune