I have figured this out myself, I just need to multiply y with the interval of an element in the x axis t(2)-t(1).
using conv to convolve two functions
6 views (last 30 days)
I need to compute a convolution of a Gaussian (with unit area) and a stretched-exponential (SE) . For , this function simplifies to an exponential, for which I have an analytical formula describing the convolution.
To compute the convolution, I use this code:
function y = GaussSEConv(t,w,x0,tau,beta)
Girf=Gaussian(t,1,x0,w); % Gaussian with area = 1
f=StretchedExponential(t,tau,0,beta); % stretched exponential without any amplitude, i.e. with A=1
x0=x0+dx; % shift x0 by half the interval in x to match the analytical formula
y(length(t)+1:end)=; % crop y to have the same axis
For , I can compare the output of this function with the result of the analytical formula. The shape of the function given by the convolution code is identical to the ouput of the analytical formula, but I have a problem with the amplitude of the resulting convolution. Using the analytical formula, I get what I would expect from a convolution. For typical data
t=(0:2:400)'; w=6; x0=50; tau=30; beta=1;
and the analytical formula I get
which should be the integral of the convolution of the two functions (1*tau=tau).
Using the above convolution code produces
The difference between the code and the analytical formula depends on the chosen axis t, coefficient τ and probably also on the coefficient β (difficult to test).
What factor am I missing?
I forgot to mention that .