# Plotting Fourier transform of integral function on Matlab

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)) But it doesn't look anything like how I would expect it to look. Does anyone have any suggestions?

• what would you have expected? – tired Jan 19 '17 at 21:13
• @tired On Mathematica I produced something very different. – Jason Born Jan 19 '17 at 21:14
• I think you mistyped if $|s|<1$ instead of $|t|<1$ – polfosol Jan 19 '17 at 21:14
• @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. – Jason Born Jan 19 '17 at 21:21
• 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. – Robert Israel Jan 19 '17 at 21:33