1D integration with symbolic limit

1 view (last 30 days)
Wardo
Wardo on 21 Jan 2017
Answered: Walter Roberson on 22 Jan 2017
Hi all
I wish to calculate the measured response of a photodiode.
The photodiode has a gaussian instrument response function (IRF) while the input of the photodiode is a decaying exponential.
The IRF is defined as follows:
IRF = @(t) 1./(w*sqrt(2*pi)).*exp(-1/2*(t./w).^2);
where w is a numerical, known measured value.
The input decaying exponential signal is defined as follows:
decay_true = @(t) heaviside(t).*exp(-t/tau);
where tau is a numerical value.
The measured response at time t is the casual convolution of these two signals:
measured_signal = @(t) integral(@(tprime) IRF(tprime).*decay_true(t-tprime),tprime,-Inf,t)
I wish to pass this function a numerical array of "times" as follows
time = -1:0.001:1;
y = measured_signal(time);
plot(time,y);
However, MATLAB does not like variable integration limits, giving the error:
Error
A and B must be floating-point scalars.
Can anyone suggest how this integral can be computed with reasonable speed? I wish to pass this to a fitting algorithm later.
Thanks in advance!
Sincerely,
Ward Newman

Answers (1)

Walter Roberson
Walter Roberson on 22 Jan 2017
If you have the Symbolic Toolbox then
syms IRF(t) decay_true(t) measured_signal(t)
syms tprime tau w Pi real
Pi = sym('pi');
IRF(t) = 1./(w*sqrt(2*Pi)).*exp(-1/2*(t./w).^2)
decay_true(t) = heaviside(t).*exp(-t/tau)
measured_signal(t) = int(IRF(tprime).*decay_true(t-tprime),tprime,-inf,t)
time = -1:0.001:1;
y = measured_signal(time);
You will find that this general solution depends upon sign(w). Also, I make the possibly unwarranted assumption that w and tau are real valued.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!