I want to evaluate the Laplace transform of a discrete stochastic signal I sample from a communication device.
As a simple test case I am trying to use the ilaplace
to get the original signal, but I am not sure if my approach is plausible.
x = sym('x','real');
y = sym('y','real');
t=linspace(0,1000,1000);
f=sin(t);
s = x+i*y;
F_s=sum(f.*exp(-s*t));
ilaplace(F_s)
The above might seem silly, though in my real problem I am trying to estimate the medium Green's function which is of the formilaplace(2*F_s/(-s*F_s +f(0)))
.
I have also tried to use a signal symbolic variable s
and it gives me a train of deltas which I am not sure it's correct and what is the error estimation.
syms s;
F_s = symfun(sum(sin(t).*exp(-s*t)), s);
ilaplace(F_s)
Ok so that's the way I used matlab to do laplace transform for a discrete signal and recovered it back using ilaplace for validation purposes:
t=linspace(0,10,500);
f=exp(-t/0.2);
syms s;
F_s = sum(f.*exp(-s*t));
f_t = (ilaplace(F_s));
F_t = (int(f_t));
y=subs(F_t,t);
Ft_recovered = diff(double(y));
subplot(2,2,1)
plot(t,f)
title('numerical input exp(-t/0.2)')
subplot(2,2,2)
ezplot(F_s)
title('numerical laplace')
subplot(2,2,3)
plot(t(1:end-1), Ft_recovered)
title('recovered signal')
subplot(2,2,4)
syms x;
fx = symfun(exp(-x/0.2),x);
ezplot(laplace(fx))
title('symbolic laplace transform')
The big difficulty here is to make matlab to evaluate the sum of the dirac delta train, so I did this trick: integrated the expression to convert it to train of heaviside functions, evaluate it and then plot the derivative:
F_t = (int(f_t));
y=subs(F_t,t);
Ft_recovered = diff(double(y));