Questions tagged [fourier-transform]

For questions about Fourier transforms, how they are used, and implementation details.

Filter by
Sorted by
Tagged with
3 votes
0 answers
96 views

Helmholtz decomposition of a vector field in Fourier space with Python

I have a 3D vector field and I want to extract its divergence-free part (also called transverse component), using the Helmholtz decomposition. In principle, this can be done in the Fourier space, as ...
Wil's user avatar
  • 31
1 vote
0 answers
39 views

Spectral Intensity of complex signal

I'm simulating an electromagnetic wave that has a real and imaginary part. Something like: $$ E(x,t) = A(x,t) e^{-i(\omega t - k x)} $$ Where $A(x,t)$ is some complex amplitude. Then taking the ...
Ebar's user avatar
  • 11
0 votes
0 answers
41 views

Numerical solution of nonlinear water wave equation with Dirchlet-Neumann operator

I've been trying now for quite some time to numerically solve the nonlinear water wave equation [Craig and Sulem, JCP (1993)] by using FFT to discretize the space. I present my code below. By testing ...
user30850's user avatar
  • 101
0 votes
0 answers
67 views

How to accelerate a convolution (laplace kernel) with FFT

I have the following computation I'm trying to program and accelerate with the FFT. $$ \phi(x) = \sum_{y \in Y} K(x, y) q(x), \> \> \forall x \in X $$ Where $X$ and $Y$ are sets of Cartesian ...
skailasa's user avatar
0 votes
0 answers
82 views

About Convolution Theorem

...
Deepak Kallepalli's user avatar
0 votes
0 answers
69 views

Deviation between Analytic DFT and FFT in Python

Within my work, I am trying to compare analytically retrieved power spectra with ones calculated from fft packages in python. The problem I have, is that the analytic form of the peaks I derived does ...
raeel's user avatar
  • 31
1 vote
1 answer
161 views

How to get the inverse FFt in this Fortran code?

I find this fft algorithm on the link The code looks simple and easy to implement. But it does not have inverse fast Fourier transformation. A brief search on the internet shows that to get the ...
David's user avatar
  • 11
0 votes
0 answers
20 views

Is it possible to realign sliding-window FFT-filtered output on time-line with the original signal when it is used for noise-filtering in real-time?

In real-time systems, an output data can be taken into sliding-window Fourier Transformation directly without waiting for new data. Then Fourier Transformed data can be altered (remove high ...
huseyin tugrul buyukisik's user avatar
1 vote
1 answer
127 views

Free Time Dependent Schrodinger Equation with Inhomogeneous Dirichlet boundary

There exists a FFT-based method to solve the poisson equation in inhomogeneous Dirichlet boundary condition using the sine-transform. For example, Which fourier series is needed to solve a 2D poisson ...
WhatsupAndThanks's user avatar
1 vote
1 answer
137 views

Computing convolution on non-uniform sample

How to efficiently convolve the function $h(t)=H(t)e^{-t}$ with a function $x(t)$ sampled non-uniformly, i.e. $\{x(t_0), x(t_1), ..., x(t_{N-1})\}$? $H(t)$ is the Heaviside step function, and the ...
Firman's user avatar
  • 181
3 votes
0 answers
97 views

How to take the Fourier transform of a Fibonacci chain in a Python script?

This may be an easy question to answer but I am really stuck. In several topics (especially that of quasicrystals) the Fibonacci chain's Fourier transform and diffraction pattern is mentioned. Despite ...
uhoh's user avatar
  • 1,016
4 votes
1 answer
216 views

Does DCT diagonalize the FD discretisation of the Laplacian with Neumann boundary conditions?

If one has the Poisson problem (assume $\int_{\Omega} f = 0$ and $\int_{\Omega} u = 0$): \begin{alignat}{3} \Delta u(x) &= f(x), &\quad&x\in\Omega \\ \partial_nu(x) &= 0, &\quad&...
lightxbulb's user avatar
2 votes
1 answer
77 views

Padding length and error analysis of discrete convolution by FFT

The standard algorithm for discrete convolution of two vectors $x\in \mathbb{R}^{n}$ and $y \in \mathbb{R}^{m}$ is (in essence) a FFT of the two input vectors, multiplication of the two elementwise, ...
user14717's user avatar
  • 2,125
1 vote
0 answers
125 views

Deconvolution of sinc function in spectrum calculation in FTS

In Fourier transform spectroscopy (FTS) I am calculating a broadband interferogram (e.m. frequency 190-300 GHz top-hat), then back-retrieving the spectrum by FT. Here in the figure, you can see the ...
Raizen's user avatar
  • 61
1 vote
1 answer
261 views

How to perform FFT from plane-wave basis function coefficients to real space?

I have a 3D grid in real space of grid spacing $L$ and say 21 grid points in each direction, containing e.g. a charge distribution. This is stored as a numpy array of shape ...
Protocola's user avatar
2 votes
1 answer
371 views

Numerical solution of 2D wave equation using Fourier transform and finite differences

This is the $2$-dimensional wave equation $$ u_{tt} = u_{xx} + u_{yy} $$ with initial condition $u(x,y,0)=f(x,y)$ and $u_{t}(x,y,0) = 0$. The inverse Fourier transform used is $$ u(x,y,t) = \iint \hat{...
Redsbefall's user avatar
4 votes
3 answers
506 views

Why not use the convolution theorem for explicit timestepping?

Consider the advection equation \begin{equation} \frac{\partial C}{\partial t} + u\frac{\partial C}{\partial x} + v\frac{\partial C}{\partial y} = 0 \end{equation} I want to do a forward time, center ...
nalzok's user avatar
  • 141
3 votes
1 answer
46 views

Bounds condition for IFT to obtain a $1/f$ time-series

I am coding a function to obtain a randomized time-series from a given $\frac{1}{f}$ law. The randomization is obtained by introducing a random phase in the function. I experience a problem in the ...
Raizen's user avatar
  • 61
1 vote
0 answers
54 views

How do people deal with resized grid steps while numerically integrating using discrete Fourier Transform?

I am trying to simulate light propagation on python using FFT following the Fresnel diffraction equation given on Wikipedia: The problem with this is that the output matrix from the DFT would be ...
Romutulus's user avatar
1 vote
0 answers
83 views

How do you correctly implement Scipy's FFT procedures to produce a low-pass filter - image processing

I'm following this low-pass filter example in the text "Image Operators: Image Processing in Python 1st Edition" by Jason M. Kinser, but can't seem to duplicate their results. The text's ...
Lagreeni's user avatar
3 votes
0 answers
69 views

3D Cooley-Tukey FFT

To compute the $N$-point DFT $$ X[k] = \sum_{n=0}^{N-1} x[n] W_N^{kn} $$ where $N = N_1 N_2$, we can write the indices as $n = N_2 n_1 + n_2$ and $k = k_1 + N_1 k_2$, (effectively packing the data ...
Brian's user avatar
  • 31
1 vote
1 answer
299 views

2D DFT for lower frequencies only; is there something significantly faster than numpy.fft.fft2 (throwing away high frequencies)?

I do a lot of 2D discrete FFT in python using np.fft.fftshift(np.fft.fft2(y)), then throw away 90% or more of the array, keeping only the central low-frequency area....
uhoh's user avatar
  • 1,016
1 vote
0 answers
129 views

Fast evaluation of trigonometric polynomials

Suppose you have a trigonometric polynomial of the form \begin{equation*} x(t) = \sum_{k = 0}^N a_k \cos(2 \pi k f_0 t). \end{equation*} Using Clenshaw algorithm, one can evaluate this polynomial in $...
avril_14th's user avatar
2 votes
1 answer
281 views

Why do problems arise in FFT for smaller value of df in Python?

...
Subhadip Saha's user avatar
1 vote
1 answer
266 views

Solving Poisson-like PDE with FFT

Problem I have an $n\times n$ grid, and each point on the grid is assigned two values: a score, and an (inverse) speed factor. There is a "turtle" moving along the grid, and it's goal is to ...
programjames's user avatar
-1 votes
1 answer
272 views

How to obtain the exact value of wavelength from a 2D FFT amplitude vs wavenumber plot like it is obtainable from 1D FFT amplitude vs wavenumber plot?

I have a two dimensional multi modal spatial signal generated from a MATLAB code using sinusoidal functions of different wave numbers, amplitudes and phases. What I want to know is that if I have the ...
Shataneek Banerjee's user avatar
1 vote
1 answer
91 views

Improving efficiency of FFT for large time window and single frequency pulses

Spectral methods for pulse propagation usually require at least one FFT and one iFFT for each step. In my case I have a two-dimensional radially symmetric electric field (one dimension in space, one ...
arc_lupus's user avatar
  • 543
1 vote
1 answer
1k views

Reason behind different outputs for Fast Fourier Transform in Numpy and Matlab

Here is the output of Numpy np.fft.ifft([0, 4, 0, 0]) array([ 1.+0.j, 0.+1.j, -1.+0.j, 0.-1.j]) # may vary Here is the output of Matlab ...
FreeMind's user avatar
  • 149
1 vote
0 answers
72 views

Fourier transform in finite element

I have a finite element solver where I am using tetrahedral elements. I am solving for electric potentials and then calculate the current densities in each element, which are constant in each element. ...
strahd's user avatar
  • 11
1 vote
2 answers
439 views

The derivative of a gauss function via FFT and IFFT in Python

I have a problem with computing a derivative of a Gauss function using FFT and IFFT from NumPy library. I use the fact that $$ \begin{equation} \frac{d}{dx}f(x) = \frac{1}{\sqrt{2\pi}}\int{ike^{ikx}\...
CptWprdl's user avatar
1 vote
1 answer
5k views

Understanding why scipy.fft.fft (fast Fourier transform) doesn't work as expected

I write the following fast Fourier transform code into my Python notebook expecting to see a plot wherein there's a spike at $1/2\pi$ since that's the frequency of the sin function, but instead I get ...
user avatar
0 votes
0 answers
492 views

How to take convolution of two arrays in Python by using NumPy?

Generally, we know that if we have this relation between Fourier transforms of three functions in frequency domain as: $$\mathfrak{F}\{\mathsf{P}(t)\} = \mathfrak{F}\{\mathsf{Z}(t)\}\mathfrak{F}\{\...
Mithridates the Great's user avatar
1 vote
0 answers
74 views

Problems with simulation of a spatial filter 4f setup (Python)

I have a question about my code which computes numerically the output field of a 4f setup with a pinhole in the middle which works as a spatial filter. My setup consists of two lenses with 50mm focal ...
Nabla94's user avatar
  • 11
6 votes
3 answers
3k views

Computing numeric derivative via FFT - SciPy

I wrote the following code to compute the approximate derivative of a function using FFT: ...
Leonardo Araujo's user avatar
4 votes
1 answer
201 views

How to define a dimensionless Objective function for determining how peaked a curve is?

I have attached 2 plots for FFT spectra. One is considered good and one is bad. The good one is classified on the basis of how closely spaced the frequencies and the bad is based on how multiple ...
Edwin Rajeev's user avatar
1 vote
0 answers
36 views

Solving a spectral system by reducing it to a single frequency - Feasability of approach?

I'm trying to solve the linear non-paraxial pulse propagation equation $$\partial_z\hat{E}=ik_z\hat{E}$$ for a field defined as $$E=E(r, t, z)$$ The equation given above uses $$\hat{E}=\hat{E}(k_\perp,...
arc_lupus's user avatar
  • 543
3 votes
1 answer
274 views

Problem implementing convolutions exactly with the FFT

I'm trying to perform convolutions as defined mathematically $f \star g (\tau)= \int_{\mathcal{R}}f(t-\tau)g(t) dt$ in a numerical simulation. Hence, my signal is a sampling of points $f(x_i)$. I ...
Comrad dau's user avatar
2 votes
1 answer
139 views

Fourier spectral method for coordinate transformed heat equation

As the title said, I want to solve a coordinate transformed heat equation using fourier spectral method. In particular, I am interested in transforming an uniform grid into an adaptive non-uniform ...
WhatsupAndThanks's user avatar
1 vote
0 answers
86 views

Advantage of fractional Fourier transform over multiscale wavelet?

What could be the arguments of using fractional Fourier transform instead of multiscale wavelet for data analysis ? Optimization of the good time-frequency domain parameter? good in the sens of best ...
sharl's user avatar
  • 57
4 votes
1 answer
209 views

Computation of triple nested loops as a convolution product?

I'm trying to compute efficiently the following \begin{equation} A_j = \sum_{l'=1}^{\infty}\sum_{k= 0}^{K-1} L_{l'}T_ke^{2\pi i \frac{k}{K}j}\epsilon_{l',k} \end{equation} for $j = 0,1, \ldots, K-2,K-...
HansimGlück's user avatar
1 vote
0 answers
49 views

FFT convolution works only with certain domain length

in my quest to understand how I can use FFT to compute integrals (see my other question click, still no answer there), I came across the fact that a convolution of two functions can be calculated by ...
reloh100's user avatar
  • 153
1 vote
0 answers
100 views

How do I calculate the amplitude after a 2D r2c transform using FFTW?

...
mmrbest's user avatar
  • 11
2 votes
0 answers
21 views

Normalising DFTs Correctly

I have been playing around with convolutions in scipy's signal package: ...
Max Hart's user avatar
0 votes
0 answers
214 views

Smoothing FFT result

I am trying to calculate the spectrum of Bremmstrahlung, which involves calculating the Fourier transformed acceleration. I am solving a non-linear ODE to numerically calculate the acceleration in the ...
Prav001's user avatar
  • 109
4 votes
1 answer
216 views

Differences between Discrete Fourier Transform and Continuous Fourier Transform?

I am trying to visualize the time dependence of a free particle given an initial wave-function using Python and I just wanted to know if I could use the in built FFT implementation from NumPy to find ...
Lawrence Wang's user avatar
2 votes
0 answers
33 views

Palmprint Identification - Why do we align the images before we use the Fourier Transform?

I am currently reading the paper PALMPRINT IDENTIFICATION BY FOURIER TRANSFORM by WENXIN LI, DAVID ZHANG and ZHUOQUN XU about identifying persons based on an image of their palm, one version of the ...
Imago's user avatar
  • 121
1 vote
1 answer
91 views

Obtain velocity from imposed energy spectrum using the inverse FFT

I am trying to obtain the spatial representation of $u(x)$ (e.g. velocity) from its energy spectrum $E(k)=k^4\exp(-(k/k_0)^2)$, which is given in the frequency domain, provided $|u(k)|=\sqrt{2E(k)}$. ...
Adr's user avatar
  • 173
2 votes
1 answer
155 views

Fusing callbacks with FFTs: an open-source GPU FFT implementation?

I'm using cuFFT to do some 2D FFTs on matrices of size 2048x2048 or larger. The FFTs are preceded and followed by various scaling operations. These scaling operations are memory-bound, so they take ...
Richard's user avatar
  • 3,891
3 votes
1 answer
227 views

Calculating the Convolution Using DFT (FFT)

I have the following convolution as part of a numerical simulation. $$T(r)=\int \mathrm{d}^3r_2\, p(r_2)f(r_2)\alpha(r-r_2)\, .$$ My problem is that the analytical expressions for $f$ and $p$ do ...
lattitude's user avatar
  • 131
1 vote
2 answers
850 views

Numpy FFT gives me a pulse shorter than it should be. Not sure what I am doing wrong

I've created a code (Python, numpy) that defines an ultrashort laser pulse in the frequency domain (pulse duration should be 4 fs), but when I perform the Fourier Transform using DFT, my pulse in the ...
python_enthusiast's user avatar