- Jan 20, 2001
- 2,081
- 0
- 0
has anyone written a function that will do 1-d time domain convolution of 2 finite length discrete vectors? i feel like this should be a very standard function, but i cant find it anywhere. i've tried writing my own, but not being a very good c++ programmer, i dont know how to deal with the fact that when the filter is not "full", (k-a) is a non existent index (negative)
int[] convolve(signal[], channel[])
{
int n,k;
int y[n];
for(k=0;k<n;k++)
{
for(a=0;a<n;a++)
{
y[k]+=signal[k-a]*channel[a];
}
}
return y;
}
that is what i have , but can someone help me with the syntax, or provide me with simply a better function?
thanks,
david
int[] convolve(signal[], channel[])
{
int n,k;
int y[n];
for(k=0;k<n;k++)
{
for(a=0;a<n;a++)
{
y[k]+=signal[k-a]*channel[a];
}
}
return y;
}
that is what i have , but can someone help me with the syntax, or provide me with simply a better function?
thanks,
david
