fft

CUDA fft 2d different results from MATLAB fft on 2d

南笙酒味 提交于 2019-12-13 18:01:44
问题 I have tried to do a simple fft and compare the results between MATLAB and CUDA on 2d arrays. MATLAB: array of 9 numbers 1-9 I = [1 2 3 4 5 6 7 8 9]; and use this code: fft(I) gives the results: 12.0000 + 0.0000i 15.0000 + 0.0000i 18.0000 + 0.0000i -4.5000 + 2.5981i -4.5000 + 2.5981i -4.5000 + 2.5981i -4.5000 - 2.5981i -4.5000 - 2.5981i -4.5000 - 2.5981i And CUDA code: int FFT_Test_Function() { int width = 3; int height = 3; int n = width * height; double in[width][height]; Complex out[width]

STFT Clarification (FFT for real-time input)

落花浮王杯 提交于 2019-12-13 16:50:34
问题 I get how the DFT via correlation works, and use that as a basis for understanding the results of the FFT. If I have a discrete signal that was sampled at 44.1kHz, then that means if I were to take 1s of data, I would have 44,100 samples. In order to run the FFT on that, I would have to have an array of 44,100 and a DFT with N=44,100 in order to get the resolution necessary to detect a frequencies up to 22kHz, right? (Because the FFT can only correlate the input with sinusoidal components up

CUFFT with double precision

a 夏天 提交于 2019-12-13 16:34:05
问题 I am experiencing some problems with CUDAs FFT library. I declared the inputs as cuDoubleComplex, but the compiler returns the error that this type is incompatible with parameters of type cufftComplex. After some search through the Internet, I found the file cufft.h, in which there is the line typedef cuComplex cufftComplex; . My problem is that in the library cuComplex.h it is clear that cuComplex has a single floating point precision ( typedef cuFloatComplex cuComplex; ), but I would like a

Calculating nth Roots of Unity in Python

ε祈祈猫儿з 提交于 2019-12-13 15:35:39
问题 So, I'm trying to write an algorithm croot(k, n), that returns the kth root of unity with n == n. I'm getting mostly the right answer, however it's giving me really weird representations that seem wrong for certain numbers. Here is an example. import cmath def croot(k, n): if n<=0: return None return cmath.exp((2 * cmath.pi * 1j * k) / n) for k in range(8): print croot(k, 8) Output is: (1+0j) (0.70710...+0.70710...j) (6.12323399574e-17+1j) Whoa whoa whoa. So the root when k = 2 and n = 8 is

Finding for convolution kernel if many 0's for FFT?

独自空忆成欢 提交于 2019-12-13 13:44:47
问题 I know that original_image * filter = blur_image , where * is the convolution. Thus, filter = ifft(fft(blur)/fft(original)) I have an original image, the known filter, and the known blurred image. I tried the following code. I just want to compare the computed filter using fft and ifft and compare it with the known filter. I tried in Matlab: orig = imread("orig.png") blur = imread("blur.png") fftorig = fft(orig) fftblur = fft(blur) div = fftblur/fftorig conv = ifft(div) The result doesn't

How to perform FFT on WAV file data?

老子叫甜甜 提交于 2019-12-13 13:28:52
问题 I'm trying to analyse the audio quality of a file by detecting the highest frequency present (compressed audio will generally be filtered to something less than 20KHz). I'm reading WAV file data using a class from the soundstretch library which returns PCM samples as floats, then performing FFT on those samples with the fftw3 library. Then for each frequency (rounded to the nearest KHz), I am totalling up the amplitude for that frequency. So for a low quality file that doesn't contain

ifft(fft(audio)) is just noise

☆樱花仙子☆ 提交于 2019-12-13 13:07:57
问题 whether i just nest them ( iff(fft(audio)) ) or try window-by-window ( window the audio, do the fft , do the ifft , then invert the window, replacing zero with eps, then merge the samples back (trying abs here and there in the pipelines)) i get only noise. i know the ifft is only inverse to the fft with infinite precision arithmetic, infinitely many samples, etc (right?) i'm working with 64bit floating point and 44kHZ sample rate. but, i would expect to be able to at least hear the original

fftshift/ifftshift

大兔子大兔子 提交于 2019-12-13 12:30:09
问题 Please, see the the description of both fftshift and ifftshift . I would like to understand how to call the above two functions in relationship with fft and fftn in Matlab. Let say that my signal has a certain frequency content; now, the frequency array can generally be stored as: f = (-N/2:N/2-1)*df; f = (1:N)*(df/2); f = [(0:N/2-1) (-N/2:-1)]; What is the best way to call fft , coupled with fftshift and ifftshift , for the 3 study cases early mentioned? What is the effect on the standard

Is this Fourier Analysis of Luminance Signals Correct? (Android)

回眸只為那壹抹淺笑 提交于 2019-12-13 08:40:59
问题 I'm writing an Android app that measures the luminance of camera frames over a period of time and calculates a heart beat using Fourier Analysis to find the wave's frequency. The problem is that my spectral analysis looks like this: which is pretty much the inverse of what a spectral analysis should look like (like a normal distribution). Can I accurately assess this to find the index of the maximum magnitude, or does this spectrum reveal that my data is too noisy? EDIT: Here's what my camera

Android: Finding fundamental frequency of audio input

独自空忆成欢 提交于 2019-12-13 08:20:00
问题 So, I've been trying for some time now to find the best solution to calculate the fundamental frequency of a sample captured using AudioRecord in real-time. I have looked around some examples around here on SO: This one, and this one are the questions that helped me the most, but I still did not understand fully how they would work for finding the fundamental frequency. So what I am looking for is a more detailed explanation of what do I need to do to find the fundamental frequency having a