0
$\begingroup$

Let $t\ge 0$ and let $f_{s}(t)$ be the sampled version of $f(t)$.

If $$f(t)=\begin{cases}\int_{0}^{t}\exp\left(-\frac{1}{1-s^{2}}\right)\,ds,&|s|<1, \\ 0,&\text{otherwise}.\end{cases}$$

I used

Plot[NIntegrate[
Piecewise[{{Exp[-1/(1 - s^2)], Abs[s] < 1}, {0, Abs[s] >= 1}}], {s, 
0, t}], {t, 0, 2}

which looks like this:

enter image description here

which is as I would expect.

Then we sample for arbitrary time interval $T=1/10$ to get

$$\begin{aligned}f_{s}(t)&=\sum_{n=-\infty}^{\infty}f(n/10)\delta(t-n/10) \\ &=\begin{cases}\int_{0}^{n/10}\exp\left(-\frac{1}{1-s^{2}}\right)\,ds\cdot\delta(t-n/10),&|s|<1, \\ 0,&\text{otherwise}.\end{cases} \end{aligned}$$

However, for the sampled function, when I use

DiscretePlot[
  Accumulate[ 
    Table[ 
      NIntegrate[ 
        Piecewise[
          {{Exp[-1/(1 - s^2)]*DiscreteDelta[t - n*0.1], Abs[s] < 1}, 
           {0, Abs[s] >= 1}}], 
        {s, 0, n*0.1}, 
        AccuracyGoal -> 20], 
      {n, -20, 20}]],
  {t, 0, 2}]

this yields:

enter image description here

which clearly isn't how it should look.

Moreover, when I attempt to perform a discrete time Fourier transform on the sampled data using

Plot[
  FourierSequenceTransform[
    NIntegrate[
      Piecewise[{{Exp[-1/(1 - s^2)], Abs[s] < 1}, {0, Abs[s] >= 1}}], 
      {s, 0, 0.1 n}, 
      AccuracyGoal -> 20], 
    {n, -20, 20}, 
    ω], 
  {ω, -20, 20}]

I fail to get the n in the FourierSequenceTransform argument, since it is in the integral limit, I think. But there must be a way to bypass this obstacle?

$\endgroup$
12
  • 1
    $\begingroup$ your formatted mathematical expressions don't make sense. Do you mean for the integral to be outside the piecewise expression (As it is in the mathematica form )? $\endgroup$
    – george2079
    Dec 8, 2016 at 22:50
  • $\begingroup$ @george2079 No, I don't, so thanks for pointing that out. However, using DiscretePlot[ Accumulate[ Table[Piecewise[{{NIntegrate[Exp[-1/(1 - s^2)], {s, 0, n*0, 1}, AccuracyGoal -> 20]*DiscreteDelta[t - n*0.1], Abs[s] < 1}, {0, Abs[s] >= 1}}], {n, -20, 20}]], {t, 0, 2}] also fails to yield what I want. $\endgroup$
    – Jason Born
    Dec 8, 2016 at 22:57
  • $\begingroup$ your first plot is this right? f[t_] := NIntegrate[Exp[-1/(1 - s^2)], {s, 0, Min[1, t]}]. That's not what your piecewise expression says.. $\endgroup$
    – george2079
    Dec 8, 2016 at 23:06
  • $\begingroup$ @george2079 I actually used Plot[NIntegrate[ Piecewise[{{Exp[-1/(1 - s^2)], Abs[s] < 1}, {0, Abs[s] >= 1}}], {s, 0, t}], {t, 0, 2}] $\endgroup$
    – Jason Born
    Dec 8, 2016 at 23:36
  • 1
    $\begingroup$ Do you mean discretizing like this: ListPlot[Table[{t, NIntegrate[ Piecewise[{{Exp[-1/(1 - s^2)], Abs[s] < 1}}], {s, 0, t}]}, {t, 0, 2, 1/10}]] ? $\endgroup$ Dec 9, 2016 at 13:28

0

Your Answer

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