Questions tagged [fft]
FFT is short for fast Fourier transform, any of a set of algorithms for quickly computing the discrete Fourier transform (DFT).
5,267
questions
0
votes
0
answers
36
views
How to compute fourrier transform on computer?
I would like to compute the fourrier transform nummerially.
As a simple example I chose a box function given by
function step(x)
if abs(x) < a
return 1
else
return 0
end
end
which has the ...
-1
votes
0
answers
6
views
How to implement Radon FT and Segmented Radon FT using MATLAB?
How to implement "radon ft"(RFT) and "segmented Radon ft"(SRFT) using matlab?
As the title says, I want to use matlab to implement RFT and SRFT, but I have no idea at all. If ...
-1
votes
0
answers
9
views
Random pixels on display 128x64 arduino
This is the display
` #include "fix_fft.h"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
...
0
votes
0
answers
44
views
Understand FFT generated by MathNet.Numerics
Below is the code I wrote to calculate FFT for a simple wave, 10 oscillations with 200 samples, as expected FFT gave the frequency as 20.
But when I created a wave of 100 oscillations with 2000 ...
0
votes
0
answers
4
views
correction of a signal played with speakers
I have 8 speakers, I created a signal and play it while recording it, so i have 8 arrays, I calculated the phase and the amplitudes of the signals and i want now to correct them all to make them being ...
0
votes
0
answers
14
views
How to apply Discrete Fourier Transform's shift theorem in Python?
I am trying to better understand the Discrete Fourier Transform and its shift theorem.
import numpy as np
from numpy import pi
from numpy.fft import fft
from numpy.fft import ifft
from numpy.fft ...
0
votes
0
answers
11
views
number of expected time bins when performing stft with scipy.signal.stft()
I am using scipy.signal.stft() to compute the spectrogram for a set of samples with sampling frequency of 2.048 MHz, with 2^18 samples, fft size of 128 and overlap of 75%, with hamming window. ...
0
votes
0
answers
21
views
Fourier transform on image Matlab
I'm having problems to get the correct fourier trasform of an image.
I have an MRI image of the brain and I have to compute the FT of it. I should get something like a big white cross in the center ...
1
vote
1
answer
41
views
Calculating Fourier coefficients in Python using fft and correctly matching the fundamental frequency
I have a curve in xyz coordinates. I want to fourier expand this curve as:
Curve fourier expansion.
I would like to calculate the coefficients of the expansion xc,m,xs,m, ... by using an fft in ...
0
votes
0
answers
50
views
Equivalent of Python scipy.signal.correlate in C# or C++
I have code in Python that searches for matching a small audio file within a large audio file. For this purpose it uses the scipy.signal.correlate function, I searched for an equivalent function in C# ...
0
votes
1
answer
32
views
Fourier Analysis, Getting Waves
I have periodic signal consisted of different waves and I used numpy.fft() to get results. Lenght of this array turned out to be 1023, as I have understood I have to plot the waves indivicually. I don'...
1
vote
1
answer
63
views
What is wrong with this inverse FFT implementation
I am using the following implementation of an inverse Fast Fourier transform (FFT) for images in which the image of size N by N is stored in a vector of length N x N (with N a square number). When I ...
0
votes
0
answers
32
views
Difference between PSD results of the data calculated by the numpy and scipy modules
For the calculation of one-dimensional data, I compared the PSD
results of numpy and scipy, and found that the calculation results
of np.fft.fft() and scipy.signal.periodogram() are the same, but the
...
0
votes
0
answers
9
views
Restoring Clipped Sinusoidal Data
I have an 1D array of sinusoidal data. The upper part of the data are clipped as shown in the image. Clipped signal
Now I think that the actual sinusoidal signal can be obtained by taking fft of the ...
0
votes
0
answers
26
views
Why does this code not return the correct fft frequencies?
I'm writing a code and I want to create a function that receives the amplitudes, frequencies and shifts and the points to be evaluated and returns a sum of sines with such amplitudes, frequencies and ...
0
votes
0
answers
9
views
How to construct Wiener Filter from powerspectrum?
I am trying to construct a Wiener Filter, to filter the ratio of the peak from the cross-correlation function, between a galaxy spectra and a template spectra, with the peak of the auto-correlation ...
0
votes
0
answers
18
views
Discrete sample with no sampling rate - Freq. space and power
graph 1 - signal
graph 2 - freq space and power
Could someone help me figure out how to get the second graph from this signal using Matlab functions?
x = r(n+6) - r(n+4) + r(n+2) - 2.*r(n) + r(n-4)
...
1
vote
0
answers
30
views
Finding the impulse response of a system with known input and output
I'm trying to find out the impulse response for my system, I have a given input and output matrices stored in ".npy" file, the goal is to calculate the impulse response using Fourier ...
1
vote
0
answers
38
views
Python - Spectral analysis
Is there a way to display spectral analisys resoult as a number in exact harmonical freqyencys?
I've got raw voltage measurements for a household, so expected power suply is sinusoidal waveform, 300V ...
-1
votes
1
answer
61
views
find initial guess for frequency of ~sin^2 data in python
I am currently facing a problem of having to guess an already rather accurate frequency from data that I do not know the frequency of.
I know that the data should relate to fit = A* sin^2(ω * t + φ) ...
-1
votes
1
answer
19
views
Trigonometric Fourier coefficients calculated with numpy FFT off by a factor of two
I'm trying to calculate the trigonometric Fourier coefficients (i.e. Eq. (1) from the Fourier series Wikipedia page) using the FFT algorithms in numpy. From the numpy documentation, it appears that ...
0
votes
0
answers
46
views
mlab.specgram doesn't match pyplot.specgram
SOLVED ! Add NFFT=4096 as a parameter in the mlab.specgram function!
I want to create spectrograms from an audio file. I did that using pylot.specgram. Looks wonderful. However, I don't want python to ...
-1
votes
1
answer
41
views
MATLAB unsure of how to resolve this error: Error using / Matrix dimensions must agree [closed]
I'm running into an error where MATLAB is saying the matrix dimensions don't agree.
Matlab code and error
I looked up this error and read all the various answers and changed all of the * and / ...
0
votes
0
answers
43
views
Convert audio to frequency array and back to audio in React
I'm trying to convert musical notes to frequency domain, scale it and generate new notes in React. In below code, I just tried to reconvert the frequency array to original audio file.
import React, { ...
1
vote
1
answer
54
views
Python - how to? Filtering out multiple bands of frequencies either in Frequency(FFT) or Time(filtfilt)
I have a time series signal which I want to filter out anything that isn't a multiple of my base frequency.
I figured a digital comb filter would be a good place to start but it isn't giving me a 1.0 ...
0
votes
0
answers
61
views
How do I unwrap the phase from a Fourier transform in a way that makes physical sense?
To extract data from an 2D image, I have:
Fourier transformed the image using scipy.fft.fft2()
cropped out a specific peak that I want to investigate
performed the inverse Fourier transform with ...
0
votes
0
answers
31
views
How to extract top frequency of a graph with FFT javascript
I'm using an FFT JS library (https://github.com/indutny/fft.js/) to extract frequencies from line graph data that get new data points every second.
This is my code:
function getFrequencis(...
0
votes
0
answers
51
views
C++ Opencv Inverse fourier transformation using magnitude and phase
I take DFT method in opencv.
When I take DFT of host image, then I know I get 2 channels of result, first Real part and second Imaginary part.
Usually, we deal with Magnitude of fourier transform, so ...
0
votes
1
answer
79
views
How to calculate FFT forward and backward multiple times in fast frame rate (about 700 fps) using Intel MKL?
We have a fast camera (>= 700 fps), we need to calculate FFT on images and do some action. However, the FFT works for some frames and then crashes. The problem doesn't appear when I use slow frame ...
1
vote
2
answers
58
views
Why does the Nyquist frequency of FFT of even length dataset end up on negative side of spectrum? [closed]
When computing the FFT of an even length dataset, you end up with an even number of frequency bins, and so it is not symmetric about zero. The additional frequency bin, which is at the Nyquist ...
0
votes
0
answers
31
views
How to plot the confidence intervals of a Fourier spectrum
Hello I am trying to plot the confidence interval (CI) using the style of this figure: vertical lines that indicates the CI width . As you know the default style is a interval is a band around the ...
0
votes
0
answers
14
views
I am trying to implement fft2 (scipy) function for the two time matrix Fourier Transform and struggling with the extraction of relevant frequency
here is the code :
import numpy as np
import numpy.fft as fft
import scipy.optimize as opt
import scipy.integrate as scint
from scipy.linalg import expm
import matplotlib
import matplotlib.pyplot as ...
0
votes
0
answers
19
views
Join two fft frequency spectra
I have two frequency maps obtained from numpy fft. Like so:
def fft(self):
Y = np.fft.fft(self.data) # fft computing and normalization
Y = 2.0/self.len * np.abs(Y[:self.len//2])
frq = np....
0
votes
0
answers
42
views
how to plot the Frequency Analysis of a random images of MNIST?
I'd like to load MNIST and compute the amplititude of the power spectra of some random images. What I recive is very differnt from what I expected. How to compute the amplitude of power spectra nd ...
0
votes
0
answers
26
views
Linear convolution and ifft doesn't give the same results
% Define the sequences x[n] and h[n]
n = 0:3;
x = cos(pi*n);
h = 2*n;
% Compute the four-point DFT of x[n]
X = fft(x);
% Compute the four-point DFT of h[n]
H = fft(h);
% Compute y[n] = x[n] * h[n] ...
0
votes
0
answers
31
views
How can i downsample a 16khz wav file after doing FFT on the wav file
I extracted a wav file then applied the FFT
the sampling frequency is 16khz how can i downsample it and plot it to see the difference
also if you check fft_spectrum_abs.size it should return 8001 can ...
0
votes
0
answers
28
views
Differentiable bandpass filter?
Does anyone know of any code or implementation of a differentiable bandpass filter, one that is differentiable with respect to frequency?
I am trying to optimize a filterbank and need a filterbank ...
0
votes
0
answers
55
views
manim using fourier transform FFT
I try using manim to plot the fourier transform of a function but it gives me this error as i use the fft() method.
from manim import *
from numpy import sin
import numpy as np
class sampling(Scene):
...
0
votes
0
answers
44
views
traveling sine wave with rotating point on circle
%%manim -ql SineFunctionWithUnitCircle
from manim import *
class SineFunctionWithUnitCircle(Scene):
# contributed by heejin_park, https://infograph.tistory.com/230
def construct(self):
...
1
vote
0
answers
47
views
Problem translating simple Matlab function to Python: ifft results are different
I am trying to translate to Python a Matlab function that calculates the Stockwell Transform for a time serie. The function ("stran") is taken from FileExchange: https://ch.mathworks.com/...
0
votes
1
answer
32
views
how use fft in accelemetros data to transform in spectrum power?
I placed vibrations of a component using accelerometers, then produced a dataframe with accelerations, that is, dataframe with the following columns: accX, accY and accZ. It is a variable in time, ...
0
votes
0
answers
28
views
How to get FFT transform in MATLAB
I want to implement FFT on my signal in MATLAB, but result is not as expected. My code is shown in the following:
clear all;
f_in1=10000;
f_in2=60000;
points=4096;
fs=4096000;
t=1:4096;
...
1
vote
0
answers
72
views
Fast Fourier 2D Convolution for Neural Networks
I am stuck on implementing a 2D FFT Convolution on a neural network that I am working on. The shape of my input goes as X.shape = (100000, 1, 32, 32), where the convention here goes like (instances, ...
0
votes
0
answers
31
views
How to do the fourier transform and inverse fourier transform to perform time scaling?
Fs = 10;
Ts = 1/Fs;
t0 = 1;
t = -50:Ts:50-Ts;
x = exp(-(t/t0).^2);
y = exp(-(t/10).^2);
subplot(2,2,1)
plot(t,x)
title('Gaussian Pulse in Time Domain (1ps)')
xlabel('Time (ps)')
ylabel('Amplitude')
X ...
0
votes
0
answers
33
views
I am trying to implement jpeg compression using FFT2 instead of DCT2 in Matlab and export binary files to be decoded
As per the title, I am having more trouble trying to convert to binary file. Below are my steps.
JPEG Compression Steps
Convert RGB into 3 channels
For each channel (Y,Cb,Cr)
(2.1) If channel is Cb ...
-1
votes
1
answer
30
views
Welch for 2d (or nd) in python
I am looking for an implementation of Welch periodogram, similar to scipy.signal.welch that handles nd array.
Things I tried :
Numpy allows for nd fft using fftn but does not provide Welch algorithm.
...
0
votes
0
answers
29
views
fftshift before FT numpy
According to the numpy docs:
The values in the result follow so-called “standard” order: If A = fft(a, n), then A[0] contains the zero-frequency term (the sum of the signal), which is always purely ...
0
votes
0
answers
33
views
Angular spectrum method Python
I want to simulate the propagation of a light field in Python using the "Angular spectrum method".
It is defined as:
FT of input field
Propagate spectrum
Inverse FT
I have
def ...
0
votes
0
answers
36
views
Measuring the dB of a frequency after FFT
I have a wavfile that is read and fft'd. Sampling frequency is 22050Hz.
fs, y = scipy.io.wavfile.read('StarWars60.wav')
N = len(y)
yf = rfft(y)
xf = rfftfreq(N, 1/fs)
y is int16 and takes range [-...
0
votes
2
answers
110
views
Scipy FFT accuracy is much worse than analytical FT of a box function
I'm trying to check the accuracy of the scipy Fast Fourier Transform function using a box function which has a defined analytical expression, a sinc function. The result of the scipy FFT gives values ...