0
$\begingroup$

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:

N=32;
Vstep=25e-3;
tstep=10e-12;
tau=5e-12;
ts=0.1e-12;

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
w=(0:Nfft-1)*2*pi/Nff;t
f=w/2/pi/ts;

timeshifts=sum(exp(-1i*(0:N-1)'*w*tstep));
step=[pi 1./(1i*w(2:end))];
expdecay=1./(1/tau+1i*w);

Vf=Vstep*timeshifts.*(step-expdecay);
vt=ifft(V);

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.

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.