help! Using discrete convolution to approximate continuous convolution...?

Started by Luna Moon November 18, 2009
Hi all,

I am helping a friend on this. We would like to evaluate the
convolution of

f(x)=exp(3 * x) / (1 + exp(x) ^ 5).

However, in Maple and Mathematica, using symbolic calculations, the
convolution results in numerical oscillation (lots of spikeness). We
don't know why. We just couldn't get rid of the spikeness. And we
thought at the end of day, our end-goal is to numerically evaluate
some functions involving the convolution of f(x). So it might be
better to directly handle the convolution in discrete domain and using
Matlab's conv function.

So we wrote the following paragraph; but we just couldn't get the
scaling and positioning right. For example, let's call the convolution
g(x)=f(x) ** f(x), g(0) should correspond to the 20000th element in
the resultant z, but z(20000) doesn't give a correct number, compared
to the theoretical result of the convolution.

Could anybody please help us? We need a way to figure out the scaling
factor on the convolution result and how does it map into the
continuous convolution result. And hopefully with lots of samples, we
would be able to approximate the continuous convolution using discrete
convolution. We have to take this approach because the closed-form
expression for g(x) gives a lot spikeness and we just couldn't get a
stable convolution result via evaluating the closed-form expression at
all points.

Thanks a lot!

-------------------------------------------------------

deltat=0.001;

x= [-10:deltat:10-deltat];

y= exp(3 * x) ./ (1 + exp(x) .^ 5);

z=conv(y, y)*deltat;

figure;

plot(z);
>Hi all, > >I am helping a friend on this. We would like to evaluate the >convolution of > >f(x)=exp(3 * x) / (1 + exp(x) ^ 5). > >However, in Maple and Mathematica, using symbolic calculations, the >convolution results in numerical oscillation (lots of spikeness). We >don't know why. We just couldn't get rid of the spikeness. And we >thought at the end of day, our end-goal is to numerically evaluate >some functions involving the convolution of f(x). So it might be >better to directly handle the convolution in discrete domain and using >Matlab's conv function. > >So we wrote the following paragraph; but we just couldn't get the >scaling and positioning right. For example, let's call the convolution >g(x)=f(x) ** f(x), g(0) should correspond to the 20000th element in >the resultant z, but z(20000) doesn't give a correct number, compared >to the theoretical result of the convolution. > >Could anybody please help us? We need a way to figure out the scaling >factor on the convolution result and how does it map into the >continuous convolution result. And hopefully with lots of samples, we >would be able to approximate the continuous convolution using discrete >convolution. We have to take this approach because the closed-form >expression for g(x) gives a lot spikeness and we just couldn't get a >stable convolution result via evaluating the closed-form expression at >all points. > >Thanks a lot! > >------------------------------------------------------- > >deltat=0.001; > >x= [-10:deltat:10-deltat]; > >y= exp(3 * x) ./ (1 + exp(x) .^ 5); > >z=conv(y, y)*deltat; > >figure; > >plot(z); >
If understand convolution as g(x) = Integral( f(y)*f(x-y) dy), then convolution in your case may be calculated g(x) = f**f = x*exp(3*x)/(exp(5*x) - 1) Now it is clear, why you obtained oscillation. Analytical result has uncertainty at zero, i.e. with x=0, but it can be deleted in first order of Taylor series g~x*(1+3x)/(1+5x -1) = x(1+3x)/5x = (1+3x)/5 If I not to mistaken in calculation, it's true. Good luck