Context: I'm trying use matlab to apply a single-pole filter to a time-domain ramp waveform that is generated by a sequence of time-shifted "RC steps" that are added together.

The time domain voltage waveform is

$V(t) = \sum_{k=0}^{N-1} V_{step}(1-e^{-(t-k\Delta t_{step})/\tau})u(t-k\Delta t_{step})$

where $V_{step}$ and $\Delta t_{step}$ are constants

Using the fft of a one-sided exponential decay, the unit-step, and the time-shift property of the fft I get a frequency domain representation of:

$\mathfrak{F}(V(t)) = V_{step}\left(\sum_{k=0}^{N-1}e^{-j\omega k\Delta t_{step}}\right)\left(\frac{1}{j\omega} +\pi\delta(\omega) - \frac{1}{\frac{1}{\tau}+j\omega}\right)$

So now I want to generate this complex-valued fft manually in matlab, multiply by a filter response, and inverse fft. To start, I'm checking the frequency response of the input and its ifft to make sure it looks right:


Nfft = 2^nextpow2(max([N*tstep/ts N*tau*5/ts])); %Get enough points for the whole ramp with at least 5 tau's per exponenetial

step=[pi 1./(1i*w(2:end))];


So the frequency domain Vf looks reasonable in amplitude. However, when I take the inverse and plot vt, it is definitely not correct.

Where am I going wrong? I suspect there's something I'm missing with the fact that this is a DFT not fourier transform. Also I know there's some subtlety to the FT/DFT of the heaviside, particularly at w=0, and I know that the fft at 0 will just be the average (times N) and I'm not sure my script accomplishes this.

I do know that I can just start with the time domain and then fft it, but I'm rather curious now.

  • $\begingroup$ $V_\mathrm{step}$ and $\Delta t_\mathrm{step}$ are constants? $\endgroup$ Feb 1, 2019 at 21:41
  • $\begingroup$ Correct they are constants $\endgroup$
    – Kayson
    Feb 1, 2019 at 21:42
  • $\begingroup$ i think you need to move some parenths: $$V(t) = \sum_{k=0}^{N-1} V_\mathrm{step}(1-e^{-(t-k\Delta t_\mathrm{step})/\tau})u(t-k\Delta t_\mathrm{step})$$ $\endgroup$ Feb 1, 2019 at 21:46
  • $\begingroup$ How so? That's correct to me. The sum applies to the entire expression. $\endgroup$
    – Kayson
    Feb 1, 2019 at 21:49
  • $\begingroup$ your expression is equivalent to: $$ V(t) = \sum_{k=0}^{N-1} V_\mathrm{step}(1-e^{-(t+k\Delta t_\mathrm{step})/\tau})u(t-k\Delta t_\mathrm{step})$$ i think you need to consistently subtract $k\Delta t_\mathrm{step}$ from $t$. $\endgroup$ Feb 1, 2019 at 21:56

1 Answer 1


okay, for step 1, let's get the continuous time math down right and simplified to as much as possible. i am changing some notational convention slightly to be more consistent with Electrical Engineering practice:

$$v(t) = \sum_{k=0}^{N-1} V_\mathrm{step}(1-e^{-(t-k\Delta t_\mathrm{step})/\tau})u(t-k\Delta t_\mathrm{step})$$

$$V(j\omega) =\mathscr{F}\Big\{v(t)\Big\} = V_\mathrm{step}\left(\sum_{k=0}^{N-1}e^{-j\omega k\Delta t_\mathrm{step}}\right)\left(\frac{1}{j\omega} +\pi\delta(\omega) - \frac{1}{\frac{1}{\tau}+j\omega}\right)$$

there is a well known closed form for the summation of a geometric series:

$$ \sum_{k=0}^{N-1} x^k = \frac{x^N -1}{x-1} $$


$$\begin{align} \sum_{k=0}^{N-1} e^{-j\omega k\Delta t_\mathrm{step}} &= \sum_{k=0}^{N-1} (e^{-j\omega \Delta t_\mathrm{step}})^k \\ \\ &= \frac{(e^{-j\omega \Delta t_\mathrm{step}})^N -1}{e^{-j\omega \Delta t_\mathrm{step}}-1} \\ \\ &= \frac{e^{-j\omega N \Delta t_\mathrm{step}}-1}{e^{-j\omega \Delta t_\mathrm{step}}-1} \\ \\ &= \frac{e^{-j (\omega/2) N \Delta t_\mathrm{step}}(e^{-j (\omega/2) N \Delta t_\mathrm{step}}-e^{j (\omega/2) N \Delta t_\mathrm{step}})}{e^{-j(\omega/2) \Delta t_\mathrm{step}}(e^{-j(\omega/2) \Delta t_\mathrm{step}}-e^{j(\omega/2) \Delta t_\mathrm{step}})} \\ \\ &= e^{-j (\omega/2) (N-1) \Delta t_\mathrm{step}}\frac{(e^{j (\omega/2) N \Delta t_\mathrm{step}}-e^{-j (\omega/2) N \Delta t_\mathrm{step}})/(2j)}{(e^{j(\omega/2) \Delta t_\mathrm{step}}-e^{-j(\omega/2) \Delta t_\mathrm{step}})/(2j)} \\ \\ &= e^{-j (\omega/2) (N-1) \Delta t_\mathrm{step}}\frac{\sin(\omega N \Delta t_\mathrm{step}/2)}{\sin(\omega \Delta t_\mathrm{step}/2)} \\ \\ \end{align}$$

so i think your final expression in continuous frequency of the spectrum should be

$$V(j\omega) = V_\mathrm{step}\frac{\sin(\omega N \Delta t_\mathrm{step}/2)}{\sin(\omega \Delta t_\mathrm{step}/2)} \left(\frac{1}{j\omega} +\pi\delta(\omega) - \frac{\tau}{1+j\omega \tau}\right) e^{-j (\omega/2)(N-1)\Delta t_\mathrm{step}} $$

does that look right to you?

  • $\begingroup$ Looks right. If I replace my geometric series sum with the simplified expression, I get the same result $\endgroup$
    – Kayson
    Feb 1, 2019 at 22:43
  • $\begingroup$ So I generated the time domain representation and fft'd that to compare to my discretized version of the continuous frequency. 1) The DC is different, which is not surprising 2) The time-domain fft has a sinusoid riding on it with a few "rings" that does not appear in the continuous time frequency 3)The high frequency tail of the time domain-fft is nearly flat, whereas the continuous time frequency continues to roll off. I think this is because of the finite length of the time-domain signal. $\endgroup$
    – Kayson
    Feb 1, 2019 at 22:55
  • $\begingroup$ you'll need to do some zero-padding and make your FFT very large, if you want the discrete-frequency results to look like the continuous-frequency results. $\endgroup$ Feb 1, 2019 at 23:03
  • $\begingroup$ Well the problem is really the other way around. When I inverse fft the continuous frequency results, I don't get anything that looks close to my desired input $\endgroup$
    – Kayson
    Feb 1, 2019 at 23:16
  • $\begingroup$ well, remember the last half of the DFT really represents negative frequency. so you need to put the negative frequency bins in the last half before inverse DFT. the $\delta(\omega)$ is a little bit of a problem. you will have to approximate that Dirac Delta with a Knronecker Delta having the same area. $\endgroup$ Feb 1, 2019 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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