0
$\begingroup$

I want to plot the Fourier transform of

$$f(t)=\int_{0}^{t}\exp\left(-\frac{1}{1-s^{2}}\right)\,ds,\qquad\text{if }|s|<1,\text{ otherwise }0$$

x = -2:0.01:2 % Position vector Fs = 1000; % Sampling frequency T = 1/Fs; % Sampling period L = 1000; % Length of signal t = (0:L-1)*T; % Time vector s = @(x)heaviside(x+1).*heaviside(-x)+heaviside(x).*heaviside(1-x); % Step function r = @(x) exp(-1./(1-x.^2)).*s(x); % Bump function f = zeros(size(t)); for i = 1:length(t) f(i) = integral(r,0,t(i)); end Y = fft(f); % Fourier transformed function plot(1000*t(1:50),Y(1:50))

enter image description here

But it doesn't look anything like how I would expect it to look. Does anyone have any suggestions?

  • 0
    what would you have expected?2017-01-19
  • 0
    @tired On Mathematica I produced something very different.2017-01-19
  • 0
    I think you mistyped _if_ $|s|<1$ instead of $|t|<1$2017-01-19
  • 0
    @polfosol $f(t)=\int_{0}^{t}g(s)\,ds$ where $g\in C^{\infty}_{0}(\mathbb{R})$ and is given by $g(s)=\exp\left(-\frac{1}{1-s^{2}}\right)$ if $|s|<1$ and $0$ otherwise.2017-01-19
  • 0
    Since $f(t)$ has a nonzero constant value for $t \ge 1$, this does not have a Fourier transform (as a function). As a tempered distribution, the main terms in its Fourier transform will be a constant multiple of $\pi \delta(k) - 1/k$ (the Fourier transform of the Heaviside function), where $\delta$ is the Dirac delta.2017-01-19
  • 0
    The big positive spike you see in your plot comes from that Dirac delta. The negative spike to the right of it, I think, comes from the $-1/k$.2017-01-19
  • 0
    It is a common misconception that FFT computes the Fourier transform. This is not true. FFT is a (fast implementation of a) Discrete Fourier Transform, which is an entirely different thing. The DFT is only defined for discrete and periodic signals, yours is not. Under some conditions, the DFT can be used to *approximate* the Fourier transform, but you should never expect the two to be exactly the same. And you should think of these conditions. If you want to compute a Fourier transform in Matlab, use the symbolic library, it has an int function for integration and a fourier function for FTs.2017-01-20
  • 0
    I agree with @Florian on this. Nevertheless, I obtained a pretty similar thing using Mathematica. First you need to generate a series of sampled values of $f$ over an interval and then take its fft by `Fourier` function. Matlab plots the _real_ part of the resulting series automatically, while in Mathematica, you have to explicitly tell it.2017-01-20

0 Answers 0