Questions tagged [fourier-transform]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
62 views

Numerically computing envelope of Gibbs oscillation

If I numerically compute the envelope of $\sin(\pi t)$ using a Hilbert transform, I obtain exactly what I expect: If I do the same for $\mathrm{sinc}(t)$, still I obtain an envelope which agrees with ...
user14717's user avatar
  • 2,145
0 votes
1 answer
67 views

How to plot the power spectrum

I have an array of data whose columns are solution vectors to a system of ODEs at a specific time. I want to plot the power spectrum of a solution at a specific time, but when I attempt this I get ...
KZ-Spectra's user avatar
2 votes
0 answers
57 views

Numerical integration in Fourier space over 3D grid

I am attempting to implement a model outlined in this paper: General magnetostatic shape–shape interactions Background This model allows the calculation of magnetostatic interaction energies between ...
JasonC's user avatar
  • 31
3 votes
0 answers
131 views

Fast Fourier Transform on Meshes

I have a (closed, manifold, oriented) triangular mesh for which I build a matrix $L\in\mathbb{R}^{n\times n}$ discretising the negated Laplace-Beltrami operator. The matrix $L$ is symmetric positive ...
lightxbulb's user avatar
  • 1,271
2 votes
0 answers
67 views

Complex matrix logarithm discontinuity by solving inverse Fourier integral by alternative method to FFT

NOTE: This code is a piece of code I am using for a master's thesis, so I do not expect someone to do the work for me, but I gladly accept suggestions of any kind. However, I am trying to get the ...
SimoPape's user avatar
3 votes
0 answers
146 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
41 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
70 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 ...
foobar's user avatar
  • 51
0 votes
0 answers
91 views

About Convolution Theorem

...
Deepak Kallepalli's user avatar
0 votes
0 answers
70 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
185 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
21 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
133 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
169 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
105 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,026
4 votes
1 answer
243 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
  • 1,271
2 votes
1 answer
93 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,145
1 vote
0 answers
137 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
303 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
422 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
512 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
55 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
92 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
72 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
344 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,026
1 vote
0 answers
131 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
300 views

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

...
Subhadip Saha's user avatar
1 vote
1 answer
284 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
287 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
92 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
73 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
455 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
6k 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
503 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
4k 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
204 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
283 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
147 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
87 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
223 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
109 views

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

...
mmrbest's user avatar
  • 11
2 votes
0 answers
22 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
242 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
227 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