Response from Wolfram Technical Support at end.

Suppose that I have an instrument response function of the form:

response[t_]=0.2583*(1/(E^(0.25*(-2.6 + t))*(1 + 13.5/E^(1.67*(-2.6 + 
             t)))^10.9) + (961*(1 - E^(-0.236*(-2.6 + t))))/
             (E^(1.67*(-2.6 + t))*(1 + 13.5/E^(1.67*(-2.6 + t)))^11.9))

This function looks like this:

enter image description here

I got this function by fitting experimental data where my underlying signal should be a step function, and then taking the derivative of that fit. So the natural thing to do next is to convolve this instrument response function with a step function to verify that I am getting simulated data that matches experiment.

instantAddition[t_, t0_, amp_] = amp UnitStep[t - t0];

When I try this using fixed values of t0 and amp, it works:

simulatedData[t_] = Convolve[instantAddition[x, 50, 3.92], 
                    response[x], x, t];
Plot[simulatedData[t], {t, 0, 200}, PlotRange -> Full]

enter image description here

But when I try to do the convolution with t0 and amp unspecified (because they should really be fitting parameters), and then plug in those same values that I used above, everything blows up.

simulatedData2[t_, t0_, amp_] = Convolve[instantAddition[x, t0, amp], 
                                response[x], x, t];
Plot[simulatedData2[t, 50, 3.92], {t, 0, 200}, PlotRange -> Full]

enter image description here

What is going on here?

Edited to add an attempted (and failed) workaround: So I was worried that the step function was causing the problem, so I tried to replace the step function with a sigmoid that has a much faster rise than my data point spacing, but that broke the first case!

Edited to add response from Wolfram Technical Support: This is a machine underflow problem. They provided a workaround, and said that the issue remains under investigation. The workaround is:

Plot[Rationalize[simulatedData2[t, 50, 3.92], 0] // Evaluate, 
     {t, 0, 200}, PlotRange -> Full, WorkingPrecision -> 20] // Quiet
  • $\begingroup$ Which version of Mathematica are you using? $\endgroup$ – mikado May 22 '19 at 19:48
  • $\begingroup$ This is on on a 64-bit Windows 8.1 system. I also have access to 12.0 on another machine, and will edit this comment with whether I get the same results on that platform as soon as I test it. $\endgroup$ – Kevin Ausman May 22 '19 at 19:51
  • $\begingroup$ It works fine for me - I got the correct plot with simulatedData2. $\endgroup$ – MelaGo May 22 '19 at 19:57
  • $\begingroup$ When I try it on MMA v. 12, the first version (with the fixed t0 and amp values) breaks. $\endgroup$ – Kevin Ausman May 22 '19 at 19:57
  • 1
    $\begingroup$ I am on MMA 9.0, Windows XP. $\endgroup$ – MelaGo May 22 '19 at 20:24

Multiply the response by a UnitStep, because it probably is zero for negative time.

response[t_] = 
  UnitStep[t] (0.2583*(1/(E^(0.25*(-2.6 + t))*(1 + 
             13.5/E^(1.67*(-2.6 + t)))^10.9) + (961*(1 - 
            E^(-0.236*(-2.6 + t))))/(E^(1.67*(-2.6 + t))*(1 + 
             13.5/E^(1.67*(-2.6 + t)))^11.9)));

Convolved Responses

  • $\begingroup$ That solved it! Thank you! $\endgroup$ – Kevin Ausman May 22 '19 at 23:18
  • $\begingroup$ @KevinAusman You are welcome! I'm just glad it worked and I didn't have to go old school and go the Fourier transform route. Thank you for the accept. $\endgroup$ – Tim Laska May 23 '19 at 0:00
  • $\begingroup$ Unfortunately, the fix you found for this problem didn't help when I tried to apply it to more realistic data. I think the issue is distinct, so I have started a new question about it: mathematica.stackexchange.com/questions/198985/… $\endgroup$ – Kevin Ausman May 24 '19 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.